always delete packets from packetHistory when receiving a StopWaiting

in new AckHandler

fixes #239
This commit is contained in:
Marten Seemann
2016-08-02 13:38:13 +07:00
parent 955234487b
commit af3f69c0f1
2 changed files with 23 additions and 8 deletions

View File

@@ -89,13 +89,10 @@ func (h *receivedPacketHandler) ReceivedStopWaiting(f *frames.StopWaitingFrame)
h.ignorePacketsBelow = f.LeastUnacked - 1
h.garbageCollectReceivedTimes()
// ignore if StopWaiting is unneeded, since all packets below have already been received
if h.largestInOrderObserved >= f.LeastUnacked {
return nil
}
// the LeastUnacked is the smallest packet number of any packet for which the sender is still awaiting an ack. So the largestInOrderObserved is one less than that
h.largestInOrderObserved = f.LeastUnacked - 1
if f.LeastUnacked > h.largestInOrderObserved {
h.largestInOrderObserved = f.LeastUnacked - 1
}
h.packetHistory.DeleteBelow(f.LeastUnacked)