Skip to content

Commit

Permalink
Fix comparisons of seqno in packetmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
jech committed May 17, 2021
1 parent f3b7326 commit c86f55c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packetmap/packetmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c86f55c

Please sign in to comment.