mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 05:56:10 +05:00
fix crash on preload
This commit is contained in:
@@ -82,9 +82,12 @@ func (b *BufferPool) ReleaseBuffer(index int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *BufferPool) Used() map[int]struct{} {
|
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{})
|
used := make(map[int]struct{})
|
||||||
b.mu.Lock()
|
|
||||||
defer b.mu.Unlock()
|
|
||||||
for _, b := range b.buffs {
|
for _, b := range b.buffs {
|
||||||
if b.used {
|
if b.used {
|
||||||
used[b.pieceId] = struct{}{}
|
used[b.pieceId] = struct{}{}
|
||||||
|
|||||||
Reference in New Issue
Block a user