for inbound sessions, keep them alive for the default session lifetime, for outbound sessions keep alive for 5 ping intervals

pull/1658/head
Jeff Becker 3 years ago
parent 60cc47447f
commit 1aa2146b4a
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -329,7 +329,8 @@ namespace llarp
{
if (m_State == State::Ready || m_State == State::LinkIntro)
{
return now > m_LastRX && now - m_LastRX > SessionAliveTimeout;
return now > m_LastRX
&& now - m_LastRX > (m_Inbound ? DefaultLinkSessionLifetime : SessionAliveTimeout);
}
return now - m_CreatedAt >= LinkLayerConnectTimeout;
}

@ -34,7 +34,7 @@ namespace llarp
/// How often we send a keepalive
static constexpr std::chrono::milliseconds PingInterval = 5s;
/// How long we wait for a session to die with no tx from them
static constexpr auto SessionAliveTimeout = (PingInterval * 2) + DefaultLinkSessionLifetime;
static constexpr auto SessionAliveTimeout = PingInterval * 5;
struct Session : public ILinkSession, public std::enable_shared_from_this<Session>
{

Loading…
Cancel
Save