From 90d00d64a9c1e759bcb6c9e1405e9e0820e31253 Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Tue, 1 Jun 2021 15:59:14 +0300 Subject: [PATCH] release pieces on torrent drop --- server/torr/storage/torrstor/cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/torr/storage/torrstor/cache.go b/server/torr/storage/torrstor/cache.go index 29c9ee4..bf93155 100644 --- a/server/torr/storage/torrstor/cache.go +++ b/server/torr/storage/torrstor/cache.go @@ -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()