From f0bb45e6f4b57840ba6441cdc265c68fe643f52b Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 30 Dec 2022 19:32:16 +0100 Subject: [PATCH] Don't update packetmap for non-increasing seqnos. When using an identity packetmap, we used to update the next seqno even when packets were not increasing. Not a big deal, we'd still recover at the next sequential packet. --- packetmap/packetmap.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packetmap/packetmap.go b/packetmap/packetmap.go index e8f0627..9073cb7 100644 --- a/packetmap/packetmap.go +++ b/packetmap/packetmap.go @@ -30,8 +30,11 @@ func (m *Map) Map(seqno uint16, pid uint16) (bool, uint16, uint16) { defer m.mu.Unlock() if m.delta == 0 && m.entries == nil { - m.next = seqno + 1 - m.nextPid = pid + if compare(m.next, seqno) <= 0 || + uint16(m.next - seqno) > 8 * 1024 { + m.next = seqno + 1 + m.nextPid = pid + } return true, seqno, 0 }