Skip to content

Commit

Permalink
fix force buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol committed Sep 23, 2024
1 parent 70790ed commit e2f59fa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions proxy/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ func (b *Buffer) ReadChunk(size int, force bool) ([]byte, bool) {
defer b.mu.Unlock()

// Wait for buffer to have enough data
if !force {
for len(b.data) < size {
b.cond.Wait()
for len(b.data) < size {
b.cond.Wait()
if force {
size = len(b.data)
break
}
}

Expand Down

0 comments on commit e2f59fa

Please sign in to comment.