Skip to content

Commit

Permalink
fix crash on preload
Browse files Browse the repository at this point in the history
  • Loading branch information
YouROK committed Oct 9, 2018
1 parent 461b5e7 commit 4afea29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/torr/storage/memcache/Buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ func (b *BufferPool) ReleaseBuffer(index int) {
}

func (b *BufferPool) Used() map[int]struct{} {
if len(b.buffs) == 0 {
b.mu.Lock()
b.mkBuffs()
b.mu.Unlock()
}
used := make(map[int]struct{})
b.mu.Lock()
defer b.mu.Unlock()
for _, b := range b.buffs {
if b.used {
used[b.pieceId] = struct{}{}
Expand Down

0 comments on commit 4afea29

Please sign in to comment.