mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
cleanup out of sequence packet nums in one call
This commit is contained in:
parent
f7101cc260
commit
02e7f6b0c3
|
@ -2757,15 +2757,25 @@ namespace transport
|
||||||
if (packetNum <= m_ReceivePacketNum) return false; // duplicate
|
if (packetNum <= m_ReceivePacketNum) return false; // duplicate
|
||||||
if (packetNum == m_ReceivePacketNum + 1)
|
if (packetNum == m_ReceivePacketNum + 1)
|
||||||
{
|
{
|
||||||
for (auto it = m_OutOfSequencePackets.begin (); it != m_OutOfSequencePackets.end ();)
|
if (!m_OutOfSequencePackets.empty ())
|
||||||
{
|
{
|
||||||
|
auto it = m_OutOfSequencePackets.begin ();
|
||||||
if (*it == packetNum + 1)
|
if (*it == packetNum + 1)
|
||||||
{
|
{
|
||||||
packetNum++;
|
// first out of sequence packet is in sequence now
|
||||||
it = m_OutOfSequencePackets.erase (it);
|
packetNum++; it++;
|
||||||
}
|
while (it != m_OutOfSequencePackets.end ())
|
||||||
else
|
{
|
||||||
break;
|
if (*it == packetNum + 1)
|
||||||
|
{
|
||||||
|
packetNum++;
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
else // next out of sequence
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_OutOfSequencePackets.erase (m_OutOfSequencePackets.begin (), it);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_ReceivePacketNum = packetNum;
|
m_ReceivePacketNum = packetNum;
|
||||||
}
|
}
|
||||||
|
@ -2852,7 +2862,7 @@ namespace transport
|
||||||
if (!m_OutOfSequencePackets.empty ())
|
if (!m_OutOfSequencePackets.empty ())
|
||||||
{
|
{
|
||||||
int ranges = 0;
|
int ranges = 0;
|
||||||
while (ranges < SSU2_MAX_NUM_ACK_RANGES && !m_OutOfSequencePackets.empty () &&
|
while (ranges < 8 && !m_OutOfSequencePackets.empty () &&
|
||||||
(m_OutOfSequencePackets.size () > 2*SSU2_MAX_NUM_ACK_RANGES ||
|
(m_OutOfSequencePackets.size () > 2*SSU2_MAX_NUM_ACK_RANGES ||
|
||||||
*m_OutOfSequencePackets.rbegin () > m_ReceivePacketNum + 255*8))
|
*m_OutOfSequencePackets.rbegin () > m_ReceivePacketNum + 255*8))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue