release pieces on torrent drop

This commit is contained in:
YouROK
2021-06-01 15:59:14 +03:00
parent 74bb25152c
commit 90d00d64a9

View File

@@ -90,6 +90,9 @@ func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl {
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()
}
c.pieces = nil
c.muReaders.Lock()