append ACK ranges instead of allocating a new slice

This commit is contained in:
Marten Seemann
2022-09-05 20:15:35 +03:00
parent 62b82789c0
commit c3289188d1
3 changed files with 20 additions and 16 deletions

View File

@@ -172,7 +172,7 @@ func (h *receivedPacketTracker) GetAckFrame(onlyIfQueued bool) *wire.AckFrame {
}
ack := &wire.AckFrame{
AckRanges: h.packetHistory.GetAckRanges(),
AckRanges: h.packetHistory.AppendAckRanges(nil),
// Make sure that the DelayTime is always positive.
// This is not guaranteed on systems that don't have a monotonic clock.
DelayTime: utils.Max(0, now.Sub(h.largestObservedReceivedTime)),