don't drop datagram right away if remote LeaseSet is being requested

This commit is contained in:
orignal committed 2026-10-10 18:45:57 -04:00
1 parent c9dada338a
commit 6aa07fff5f
2 files changed
+12 -7

No files matched your search

+11 -6
View File
@@ -749,11 +749,14 @@ namespace datagram
void DatagramSession::HandleLeaseSetUpdated(std::shared_ptr<i2p::data::LeaseSet> ls)
{
m_RequestingLS = false;
if(!ls) return;
// only update lease set if found and newer than previous lease set
uint64_t oldExpire = 0;
if(m_RemoteLeaseSet) oldExpire = m_RemoteLeaseSet->GetExpirationTime();
if(ls && ls->GetExpirationTime() > oldExpire) m_RemoteLeaseSet = ls;
if (ls)
{
// only update lease set if found and newer than previous lease set
uint64_t oldExpire = 0;
if(m_RemoteLeaseSet) oldExpire = m_RemoteLeaseSet->GetExpirationTime();
if(ls && ls->GetExpirationTime() > oldExpire) m_RemoteLeaseSet = ls;
}
FlushSendQueue (false); // process deferred flush
}
void DatagramSession::RequestUpdatedLeaseSet ()
@@ -765,10 +768,12 @@ namespace datagram
}
}
void DatagramSession::FlushSendQueue ()
void DatagramSession::FlushSendQueue (bool waitForLeaseSet)
{
if (m_SendQueue.empty ()) return;
auto routingPath = GetSharedRoutingPath();
if (!routingPath && waitForLeaseSet && m_RequestingLS)
return; // defer to HandleLeaseSetUpdated
// if we don't have a routing path we will drop all queued messages
if(routingPath && routingPath->outboundTunnel && routingPath->remoteLease)
{
+1 -1
View File
@@ -73,7 +73,7 @@ namespace datagram
/** send an i2np message to remote endpoint for this session */
void SendMsg(std::shared_ptr<I2NPMessage> msg);
void FlushSendQueue();
void FlushSendQueue(bool waitForLeaseSet = true);
/** get the last time in milliseconds for when we used this datagram session */
uint64_t LastActivity() const { return m_LastUse; }