Skip to content

Commit

Permalink
resend not more than half of window
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed May 21, 2020
1 parent 9318388 commit e5901da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libi2pd/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Packet *> packets;
for (auto it : m_SentPackets)
Expand All @@ -832,6 +834,8 @@ namespace stream
{
it->sendTime = ts;
packets.push_back (it);
maxNumPackets--;
if (maxNumPackets <= 0) break;
}
}

Expand All @@ -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:
Expand Down

0 comments on commit e5901da

Please sign in to comment.