add send timeouts

pull/18/head
Jeff Becker 6 years ago
parent 983c72f032
commit 9a20daa1ce
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -188,7 +188,10 @@ namespace llarp
PathSet* m_PathSet;
IDataHandler* m_DataHandler;
Endpoint* m_Endpoint;
uint64_t sequenceNo = 0;
uint64_t sequenceNo = 0;
llarp_time_t lastGoodSend = 0;
llarp_time_t createdAt;
llarp_time_t sendTimeout = 10 * 1000;
virtual void
ShiftIntroduction(){};

@ -758,6 +758,7 @@ namespace llarp
, m_DataHandler(ep)
, m_Endpoint(ep)
{
createdAt = llarp_time_now_ms();
}
void
@ -1185,7 +1186,9 @@ namespace llarp
}
}
routing::PathTransferMessage transfer(msg, remoteIntro.pathID);
if(!path->SendRoutingMessage(&transfer, m_Endpoint->Router()))
if(path->SendRoutingMessage(&transfer, m_Endpoint->Router()))
lastGoodSend = now;
else
llarp::LogError("Failed to send frame on path");
}
else
@ -1245,8 +1248,9 @@ namespace llarp
else
++itr;
}
// TODO: check for expiration of outbound context
return false;
return lastGoodSend
? (now >= lastGoodSend && lastGoodSend - now > sendTimeout)
: (now >= createdAt && now - createdAt > sendTimeout);
}
bool

Loading…
Cancel
Save