fix freeze on close

This commit is contained in:
YouROK
2021-06-01 21:58:24 +03:00
parent 90d00d64a9
commit 1bd5a9b899
2 changed files with 3 additions and 3 deletions

View File

@@ -91,7 +91,9 @@ func (c *Cache) Close() error {
log.TLogln("Close cache for:", c.hash)
delete(c.storage.caches, c.hash)
for _, v := range c.pieces {
v.Release()
if v.dPiece != nil {
os.Remove(v.dPiece.name)
}
}
c.pieces = nil

View File

@@ -83,7 +83,5 @@ func (p *DiskPiece) Release() {
p.piece.Size = 0
p.piece.Complete = false
os.Remove(p.name)
p.piece.cache.torrent.Piece(p.piece.Id).SetPriority(torrent.PiecePriorityNone)
}