From 972bebb06d3248a3f52d0ab4fff1fccb352b1409 Mon Sep 17 00:00:00 2001 From: acetone <63557806+freeacetone@users.noreply.github.com> Date: Thu, 23 Jul 2026 21:12:14 +0300 Subject: [PATCH] refresh remote leaseset on udp ack timeout --- libi2pd/Datagram.cpp | 9 +++++++++ libi2pd/Datagram.h | 2 ++ libi2pd_client/UDPTunnel.cpp | 1 + 3 files changed, 12 insertions(+) diff --git a/libi2pd/Datagram.cpp b/libi2pd/Datagram.cpp index b69e173a..be9c84f1 100644 --- a/libi2pd/Datagram.cpp +++ b/libi2pd/Datagram.cpp @@ -747,6 +747,15 @@ namespace datagram if(ls && ls->GetExpirationTime() > oldExpire) m_RemoteLeaseSet = ls; } + void DatagramSession::RequestUpdatedLeaseSet () + { + if (!m_RequestingLS) + { + m_RequestingLS = true; + m_LocalDestination->RequestDestination(m_RemoteIdent, std::bind(&DatagramSession::HandleLeaseSetUpdated, this, std::placeholders::_1)); + } + } + void DatagramSession::FlushSendQueue () { if (m_SendQueue.empty ()) return; diff --git a/libi2pd/Datagram.h b/libi2pd/Datagram.h index 1f7e9ba6..45be618b 100644 --- a/libi2pd/Datagram.h +++ b/libi2pd/Datagram.h @@ -85,6 +85,8 @@ namespace datagram void SetVersion (DatagramVersion version) { m_Version = version; } void DropSharedRoutingPath () { if (m_RoutingSession) m_RoutingSession->SetSharedRoutingPath (nullptr); } + // request LeaseSet update from floodfill in case our copy contains dead leases + void RequestUpdatedLeaseSet (); struct Info { diff --git a/libi2pd_client/UDPTunnel.cpp b/libi2pd_client/UDPTunnel.cpp index 638337c9..fad4a501 100644 --- a/libi2pd_client/UDPTunnel.cpp +++ b/libi2pd_client/UDPTunnel.cpp @@ -216,6 +216,7 @@ namespace client if (session) { session->DropSharedRoutingPath (); + session->RequestUpdatedLeaseSet (); // in case current leases are dead m_Destination->SendDatagram (session, nullptr, 0, 0, 0, &options); } }