1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 18:25: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
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