keep fixing ring queue things

This commit is contained in:
soypat
2025-02-08 01:33:26 -03:00
parent 23cd71fcc8
commit e452ff0f0a
2 changed files with 37 additions and 28 deletions
+2 -18
View File
@@ -260,24 +260,8 @@ func (tx *ringTx) nextPkt() int {
//
// | acked(free) | sent | unsent | free |
// 0 freeEnd=first.off last.end==unsent.off freeStart=unsent.end Size()
func (tx *ringTx) lims() (freeStart, freeEnd, sentEndorUnsentStart int) {
freeStart = tx.unsentend
if freeStart == 0 {
freeStart = tx.unsentoff
}
first := tx.pkt(tx.firstPkt())
if first.sent() {
freeEnd = first.off
sentEndorUnsentStart = tx.unsentoff
} else if tx.unsentend != 0 {
// sent section empty and unsent not empty.
freeEnd = tx.unsentoff
sentEndorUnsentStart = tx.unsentoff
} else {
freeEnd = tx.unsentoff
sentEndorUnsentStart = tx.unsentoff
}
return freeStart, freeEnd, sentEndorUnsentStart
func (tx *ringTx) lims() (unsentStart, unsentEnd, sentStart, sentEnd int) {
return tx.unsentoff, tx.unsentend, tx.sentoff, tx.sentend
}
func (pkt *ringidx) sent() bool {