Fix bug in expiry of in-flight packets.

This meant the map was growing without bound!  The worse the packet
loss, the worse the growth of this map.  This didn't break the wire
protocol, it was just bad for perf.  But not that bad, because the
data structure has a good O() time and all of the old packets that
should have been expired were just not really examined.

Until I added code to check it constantly.  Then I noticed perf has
tanked!

I am actually surprised that static analysis didn't catch this.
This commit is contained in:
Fletcher Dunn
2020-05-28 10:52:34 -07:00
parent 490c8cebfe
commit 61d553eccf
@@ -1206,10 +1206,9 @@ SteamNetworkingMicroseconds CSteamNetworkConnectionBase::SNP_SenderCheckInFlight
++inFlightPkt;
// Expire old packets (all of these should have been marked as nacked)
SteamNetworkingMicroseconds usecNackExpiry = usecRTO*2;
SteamNetworkingMicroseconds usecWhenExpiry = usecNow - usecRTO*2;
for (;;)
{
SteamNetworkingMicroseconds usecWhenExpiry = inFlightPkt->second.m_usecWhenSent - usecNackExpiry;
if ( inFlightPkt->second.m_usecWhenSent > usecWhenExpiry )
break;