Skip to content

Commit

Permalink
fix(buffer): Set correct buffer boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
OrlandoCo committed Jan 6, 2021
1 parent 7ae23ae commit e170426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/buffer/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (b *Bucket) addPacket(pkt []byte, sn uint16, latest bool) []byte {
if b.nacker != nil {
b.nacker.push(sn - i)
}
if b.step > b.maxSteps {
if b.step >= b.maxSteps {
b.step = 0
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func (b *Bucket) push(pkt []byte) []byte {
off := b.step*maxPktSize + 2
copy(b.buf[off:], pkt)
b.step++
if b.step > b.maxSteps {
if b.step >= b.maxSteps {
b.step = 0
}
return b.buf[off : off+len(pkt)]
Expand Down

0 comments on commit e170426

Please sign in to comment.