limit number of tracked skipped packet numbers in SentPacketHandler

This commit is contained in:
Marten Seemann 2016-08-11 15:27:46 +07:00 committed by Lucas Clemente
parent 78fab5c264
commit 65838f34a8
3 changed files with 18 additions and 0 deletions

View file

@ -127,6 +127,10 @@ func (h *sentPacketHandler) SentPacket(packet *ackhandlerlegacy.Packet) error {
for p := h.lastSentPacketNumber + 1; p < packet.PacketNumber; p++ {
h.skippedPackets = append(h.skippedPackets, p)
if len(h.skippedPackets) > protocol.MaxTrackedSkippedPackets {
h.skippedPackets = h.skippedPackets[1:]
}
}
now := time.Now()