fix crash on preload

This commit is contained in:
yourok
2018-10-04 21:33:32 +03:00
parent b376c50fcb
commit 5a30c8428b
2 changed files with 13 additions and 6 deletions

View File

@@ -149,12 +149,7 @@ func (c *Cache) getRemPieces() []*Piece {
pieces := make([]*Piece, 0)
fill := int64(0)
loading := 0
used := make(map[int]struct{})
for _, b := range c.bufferPull.buffs {
if b.used {
used[b.pieceId] = struct{}{}
}
}
used := c.bufferPull.Used()
for u := range used {
v := c.pieces[u]
if v.Size > 0 {