mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
check out of sequence messages range
This commit is contained in:
parent
efbaf02016
commit
c50e453af6
|
@ -1174,7 +1174,7 @@ namespace transport
|
||||||
m_IsDataReceived = true;
|
m_IsDataReceived = true;
|
||||||
break;
|
break;
|
||||||
case eSSU2BlkTermination:
|
case eSSU2BlkTermination:
|
||||||
LogPrint (eLogDebug, "SSU2: Termination");
|
LogPrint (eLogDebug, "SSU2: Termination reason=", (int)buf[11]);
|
||||||
Terminate ();
|
Terminate ();
|
||||||
break;
|
break;
|
||||||
case eSSU2BlkRelayRequest:
|
case eSSU2BlkRelayRequest:
|
||||||
|
@ -2210,23 +2210,28 @@ namespace transport
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
if (m_OutOfSequencePackets.size () > 255)
|
if (!m_OutOfSequencePackets.empty ())
|
||||||
{
|
{
|
||||||
m_ReceivePacketNum = *m_OutOfSequencePackets.rbegin ();
|
if (m_OutOfSequencePackets.size () > 2*SSU2_MAX_NUM_ACK_RANGES ||
|
||||||
m_OutOfSequencePackets.clear ();
|
*m_OutOfSequencePackets.rbegin () > m_ReceivePacketNum + 255*8)
|
||||||
}
|
|
||||||
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
|
uint32_t packet = *m_OutOfSequencePackets.begin ();
|
||||||
packet--;
|
if (packet > m_ReceivePacketNum + 1)
|
||||||
m_ReceivePacketNum = packet - 1;
|
{
|
||||||
UpdateReceivePacketNum (packet);
|
// like we've just received all packets before first
|
||||||
}
|
packet--;
|
||||||
else
|
m_ReceivePacketNum = packet - 1;
|
||||||
LogPrint (eLogError, "SSU2: Out of sequence packet ", packet, " is less than last received ", m_ReceivePacketNum);
|
UpdateReceivePacketNum (packet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "SSU2: Out of sequence packet ", packet, " is less than last received ", m_ReceivePacketNum);
|
||||||
|
}
|
||||||
|
if (m_OutOfSequencePackets.size () > 255*4)
|
||||||
|
{
|
||||||
|
// seems we have a serious network issue
|
||||||
|
m_ReceivePacketNum = *m_OutOfSequencePackets.rbegin ();
|
||||||
|
m_OutOfSequencePackets.clear ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto it = m_RelaySessions.begin (); it != m_RelaySessions.end ();)
|
for (auto it = m_RelaySessions.begin (); it != m_RelaySessions.end ();)
|
||||||
|
|
Loading…
Reference in a new issue