Skip to content

Commit e170426

Browse files
committed
fix(buffer): Set correct buffer boundaries
1 parent 7ae23ae commit e170426

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/buffer/bucket.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (b *Bucket) addPacket(pkt []byte, sn uint16, latest bool) []byte {
4545
if b.nacker != nil {
4646
b.nacker.push(sn - i)
4747
}
48-
if b.step > b.maxSteps {
48+
if b.step >= b.maxSteps {
4949
b.step = 0
5050
}
5151
}
@@ -79,7 +79,7 @@ func (b *Bucket) push(pkt []byte) []byte {
7979
off := b.step*maxPktSize + 2
8080
copy(b.buf[off:], pkt)
8181
b.step++
82-
if b.step > b.maxSteps {
82+
if b.step >= b.maxSteps {
8383
b.step = 0
8484
}
8585
return b.buf[off : off+len(pkt)]

0 commit comments

Comments
 (0)