now supports partial packet acks

This commit is contained in:
soypat
2025-02-16 14:47:02 -03:00
parent 8a5f6f3f6d
commit 523f609761
2 changed files with 31 additions and 5 deletions
+3 -3
View File
@@ -192,7 +192,7 @@ func (rtx *ringTx) RecvACK(ack Value) error {
acked := int(ack - pkt.seq)
pring := rtx.ring(pkt.off, pkt.end)
buffered := pring.Buffered()
if acked > buffered || acked <= minBufferSize {
if acked > buffered || acked < minBufferSize {
panic("unreachable")
}
off := rtx.addOff(pkt.off, acked)
@@ -266,7 +266,7 @@ func (rtx *ringTx) firstPkt() int {
idx := -1
for i := 0; i < len(rtx.packets); i++ {
pkt := &rtx.packets[i]
if pkt.sent() && (idx == -1 || seq.LessThan(pkt.seq)) {
if pkt.sent() && (idx == -1 || pkt.seq.LessThan(seq)) {
seq = pkt.seq
idx = i
}
@@ -279,7 +279,7 @@ func (rtx *ringTx) lastPkt() int {
idx := -1
for i := 0; i < len(rtx.packets); i++ {
pkt := &rtx.packets[i]
if pkt.sent() && (idx == -1 || pkt.seq.LessThan(seq)) {
if pkt.sent() && (idx == -1 || seq.LessThan(pkt.seq)) {
seq = pkt.seq
idx = i
}