From 455390f1215b465beba676216d314255a30c5665 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 1 Jul 2022 10:52:10 -0400 Subject: [PATCH] clean up first out of sequence packet if too many --- libi2pd/SSU2Session.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp index ecd61f94..753da03a 100644 --- a/libi2pd/SSU2Session.cpp +++ b/libi2pd/SSU2Session.cpp @@ -2126,6 +2126,19 @@ namespace transport m_ReceivePacketNum = *m_OutOfSequencePackets.rbegin (); m_OutOfSequencePackets.clear (); } + else if (m_OutOfSequencePackets.size () > SSU2_MAX_NUM_ACK_RANGES) + { + uint32_t packet = *m_OutOfSequencePackets.begin (); + if (packet > m_ReceivePacketNum + 1) + { + // like we've just received all packets before first + m_ReceivePacketNum = packet - 1; + UpdateReceivePacketNum (packet); + } + else + LogPrint (eLogError, "SSU2: Out of sequence packet ", packet, " is less than last received", m_ReceivePacketNum); + } + for (auto it = m_RelaySessions.begin (); it != m_RelaySessions.end ();) { if (ts > it->second.second + SSU2_RELAY_NONCE_EXPIRATION_TIMEOUT)