diff --git a/src/server/torr/storage/memcache/Buffer.go b/src/server/torr/storage/memcache/Buffer.go index 52331c4c..9b8eeff2 100644 --- a/src/server/torr/storage/memcache/Buffer.go +++ b/src/server/torr/storage/memcache/Buffer.go @@ -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{}{}