1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Fix comparisons of seqno in packetmap.

This commit is contained in:
Juliusz Chroboczek 2021-05-17 22:13:30 +02:00
parent f3b73263c8
commit c86f55c3a8

View file

@ -114,8 +114,8 @@ func (m *Map) direct(seqno uint16) (bool, uint16, uint16) {
i := m.lastEntry i := m.lastEntry
for { for {
f := m.entries[i].first f := m.entries[i].first
if seqno >= f { if compare(seqno, f) >= 0 {
if seqno < f+m.entries[i].count { if compare(seqno, f+m.entries[i].count) < 0 {
return true, return true,
seqno + m.entries[i].delta, seqno + m.entries[i].delta,
m.entries[i].pidDelta m.entries[i].pidDelta
@ -154,8 +154,8 @@ func (m *Map) Reverse(seqno uint16) (bool, uint16, uint16) {
i := m.lastEntry i := m.lastEntry
for { for {
f := m.entries[i].first + m.entries[i].delta f := m.entries[i].first + m.entries[i].delta
if seqno >= f { if compare(seqno, f) >= 0 {
if seqno < f+m.entries[i].count { if compare(seqno, f+m.entries[i].count) < 0 {
return true, return true,
seqno - m.entries[i].delta, seqno - m.entries[i].delta,
m.entries[i].pidDelta m.entries[i].pidDelta