Browse Source

correct Ack range

pull/1752/head
orignal 3 years ago
parent
commit
45ebfe378b
  1. 3
      libi2pd/SSU2.cpp

3
libi2pd/SSU2.cpp

@ -897,7 +897,7 @@ namespace transport
if (*ranges > lastPacketNum) break; if (*ranges > lastPacketNum) break;
lastPacketNum -= *ranges; ranges++; // nacks lastPacketNum -= *ranges; ranges++; // nacks
if (*ranges > lastPacketNum) break; if (*ranges > lastPacketNum) break;
firstPacketNum -= *ranges; ranges++; // acks firstPacketNum = lastPacketNum - *ranges; ranges++; // acks
len -= 2; len -= 2;
HandleAckRange (firstPacketNum, lastPacketNum); HandleAckRange (firstPacketNum, lastPacketNum);
} }
@ -905,6 +905,7 @@ namespace transport
void SSU2Session::HandleAckRange (uint32_t firstPacketNum, uint32_t lastPacketNum) void SSU2Session::HandleAckRange (uint32_t firstPacketNum, uint32_t lastPacketNum)
{ {
if (firstPacketNum > lastPacketNum) return;
auto it = m_SentPackets.begin (); auto it = m_SentPackets.begin ();
while (it != m_SentPackets.end () && it->first < firstPacketNum) it++; // find first acked packet while (it != m_SentPackets.end () && it->first < firstPacketNum) it++; // find first acked packet
if (it == m_SentPackets.end ()) return; // not found if (it == m_SentPackets.end ()) return; // not found

Loading…
Cancel
Save