This commit is contained in:
YouROK
2020-11-25 23:49:51 +03:00
parent 550e279110
commit a70c6374c3
2 changed files with 15 additions and 9 deletions

View File

@@ -4,11 +4,12 @@ import (
"sort"
"sync"
"github.com/anacrolix/torrent"
"server/log"
"server/settings"
"server/torr/utils"
"github.com/anacrolix/torrent"
"github.com/anacrolix/torrent/metainfo"
"github.com/anacrolix/torrent/storage"
)
@@ -137,14 +138,15 @@ func (c *Cache) getRemPieces() []*Piece {
loading := 0
used := c.bufferPull.Used()
for u := range used {
v := c.pieces[u]
if v.Size > 0 {
if v.Id > 0 {
pieces = append(pieces, v)
}
fill += v.Size
if !v.complete {
loading++
if v, ok := c.pieces[u]; ok {
if v.Size > 0 {
if v.Id > 0 {
pieces = append(pieces, v)
}
fill += v.Size
if !v.complete {
loading++
}
}
}
}