From e5901dad9177dc1740149d164143b1230fe78854 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 21 May 2020 14:52:44 -0400 Subject: [PATCH] resend not more than half of window --- libi2pd/Streaming.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index ad3f6209..e2047b0d 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -824,6 +824,8 @@ namespace stream } // collect packets to resend + int maxNumPackets = (m_WindowSize >> 1); // /2 + if (maxNumPackets < WINDOW_SIZE) maxNumPackets = WINDOW_SIZE; auto ts = i2p::util::GetMillisecondsSinceEpoch (); std::vector packets; for (auto it : m_SentPackets) @@ -832,6 +834,8 @@ namespace stream { it->sendTime = ts; packets.push_back (it); + maxNumPackets--; + if (maxNumPackets <= 0) break; } } @@ -843,7 +847,7 @@ namespace stream switch (m_NumResendAttempts) { case 1: // congesion avoidance - m_WindowSize /= 2; + m_WindowSize >>= 1; // /2 if (m_WindowSize < MIN_WINDOW_SIZE) m_WindowSize = MIN_WINDOW_SIZE; break; case 2: