rewrite most of txQueue.String; move around couple things

This commit is contained in:
soypat
2025-02-05 01:39:26 -03:00
parent c53596166c
commit 23cd71fcc8
2 changed files with 64 additions and 53 deletions
+4 -5
View File
@@ -123,6 +123,7 @@ func (tx *ringTx) MakePacket(b []byte) (int, Value, error) {
if err != nil {
return n, 0, err
}
pkt := &tx.packets[nxtpkt]
off := tx.addEnd(tx.unsentoff, n)
tx.unsentoff = off
@@ -130,17 +131,15 @@ func (tx *ringTx) MakePacket(b []byte) (int, Value, error) {
if off == tx.unsentend {
tx.unsentend = 0 // Mark unsent as being empty.
}
pkt := &tx.packets[nxtpkt]
pkt.off = start
pkt.end = off
// Sequence number updates.
seq := tx.seq
newseq := Add(seq, Size(n))
oldseq := tx.seq
newseq := Add(oldseq, Size(n))
tx.seq = newseq
pkt.seq = newseq
return n, seq, nil
return n, oldseq, nil
}
// RecvSegment processes an incoming segment and updates the sent packet queue