relax ping to 10s of inactivity

pull/402/head
Jeff Becker 5 years ago
parent 01eae54d71
commit 4bfe97781c
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -297,7 +297,8 @@ namespace llarp
auto itr = range.first;
while(itr != range.second)
{
itr->second->SendKeepAlive();
if(itr->second->ShouldPing())
itr->second->SendKeepAlive();
++itr;
}
}

@ -61,6 +61,9 @@ namespace llarp
/// renegotiate session when we have a new RC locally
std::function< bool(void) > RenegotiateSession;
/// return true if we should send an explicit keepalive message
std::function< bool(void) > ShouldPing;
};
} // namespace llarp

@ -591,6 +591,11 @@ namespace llarp
SendQueueBacklog = [&]() -> size_t { return sendq.size(); };
ShouldPing = [&]() -> bool {
auto dlt = lastActive - parent->Now();
return dlt >= 10000;
};
SendKeepAlive = [&]() -> bool {
if(state == eSessionReady)
{

Loading…
Cancel
Save