shift intro if expired before building next message

pull/33/head
Jeff Becker 6 years ago
parent d3278946f2
commit acaeb26f45
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -1223,6 +1223,14 @@ namespace llarp
Endpoint::SendContext::AsyncEncryptAndSendTo(llarp_buffer_t data, Endpoint::SendContext::AsyncEncryptAndSendTo(llarp_buffer_t data,
ProtocolType protocol) ProtocolType protocol)
{ {
auto now = llarp_time_now_ms();
if(remoteIntro.ExpiresSoon(now))
{
if(!MarkCurrentIntroBad(now))
{
llarp::LogWarn("no good path yet, your message may drop");
}
}
if(sequenceNo) if(sequenceNo)
{ {
EncryptAndSendTo(data, protocol); EncryptAndSendTo(data, protocol);
@ -1363,21 +1371,13 @@ namespace llarp
path = m_Endpoint->GetPathByRouter(remoteIntro.router); path = m_Endpoint->GetPathByRouter(remoteIntro.router);
if(path) if(path)
{ {
auto now = llarp_time_now_ms();
if(remoteIntro.ExpiresSoon(now))
{
if(!MarkCurrentIntroBad(now))
{
llarp::LogWarn("no good path yet, your message may drop");
}
}
++sequenceNo; ++sequenceNo;
routing::PathTransferMessage transfer(msg, remoteIntro.pathID); routing::PathTransferMessage transfer(msg, remoteIntro.pathID);
if(path->SendRoutingMessage(&transfer, m_Endpoint->Router())) if(path->SendRoutingMessage(&transfer, m_Endpoint->Router()))
{ {
llarp::LogDebug("sent data to ", remoteIntro.pathID, " on ", llarp::LogDebug("sent data to ", remoteIntro.pathID, " on ",
remoteIntro.router); remoteIntro.router);
lastGoodSend = now; lastGoodSend = llarp_time_now_ms();
} }
else else
llarp::LogError("Failed to send frame on path"); llarp::LogError("Failed to send frame on path");

Loading…
Cancel
Save