From c86f55c3a8f8e3799aa208b7464818015abf4ee3 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 17 May 2021 22:13:30 +0200 Subject: [PATCH] Fix comparisons of seqno in packetmap. --- packetmap/packetmap.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packetmap/packetmap.go b/packetmap/packetmap.go index 6212385..83f79f7 100644 --- a/packetmap/packetmap.go +++ b/packetmap/packetmap.go @@ -114,8 +114,8 @@ func (m *Map) direct(seqno uint16) (bool, uint16, uint16) { i := m.lastEntry for { f := m.entries[i].first - if seqno >= f { - if seqno < f+m.entries[i].count { + if compare(seqno, f) >= 0 { + if compare(seqno, f+m.entries[i].count) < 0 { return true, seqno + m.entries[i].delta, m.entries[i].pidDelta @@ -154,8 +154,8 @@ func (m *Map) Reverse(seqno uint16) (bool, uint16, uint16) { i := m.lastEntry for { f := m.entries[i].first + m.entries[i].delta - if seqno >= f { - if seqno < f+m.entries[i].count { + if compare(seqno, f) >= 0 { + if compare(seqno, f+m.entries[i].count) < 0 { return true, seqno - m.entries[i].delta, m.entries[i].pidDelta