From e3d3d7f94657336e09cb161f1ee3e645aaaeab6c Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 30 Aug 2026 20:57:15 -0400 Subject: [PATCH] handle lifetime field from datagram tracker connect response --- libi2pd_client/TorrentsTunnel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libi2pd_client/TorrentsTunnel.cpp b/libi2pd_client/TorrentsTunnel.cpp index 8ac78ca1..3b933e45 100644 --- a/libi2pd_client/TorrentsTunnel.cpp +++ b/libi2pd_client/TorrentsTunnel.cpp @@ -887,12 +887,18 @@ namespace torrents return; } uint64_t connectionID = bufbe64toh (buf + 4); + int lifetime = DATAGRAM_TRACKER_CONNECTION_EXPIRATION; + if (len >= 14) + { + lifetime = std::max (bufbe16toh (buf + 12)*1000, DATAGRAM_TRACKER_CONNECTION_EXPIRATION); + LogPrint (eLogDebug, "TorrentsTunnel: Datagram tracker connection lifetime set to ", lifetime/1000, " seconds"); + } auto [trackerID, fromPort, torrent, ts] = it->second; if (trackerID < m_Trackers.size ()) { auto& [announce, connID, connExpiration, connFromPort] = m_Trackers[trackerID]; connID = connectionID; - connExpiration = i2p::util::GetMonotonicMilliseconds () + DATAGRAM_TRACKER_CONNECTION_EXPIRATION; + connExpiration = i2p::util::GetMonotonicMilliseconds () + lifetime; connFromPort = fromPort; } m_DatragramTrackerTransactions.erase (it);