Skip to content

Commit

Permalink
caffee bitsflow ctrl
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Dec 29, 2023
1 parent 1914237 commit 2d0d016
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/caffe/t.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ func (t *Torrent) SetBytesRequested(bytesRequested int64) {
//t.Lock()
//defer t.Unlock()
//t.bytesRequested = bytesRequested
if bytesRequested <= t.bytesRequested.Load() {
return
}

if t.Info() != nil {
if bytesRequested > t.Length() {
t.bytesRequested.Store(t.Length())
return
}
}

t.bytesRequested.Store(bytesRequested)
}

Expand Down

0 comments on commit 2d0d016

Please sign in to comment.