diff --git a/server/torr/storage/torrstor/cache.go b/server/torr/storage/torrstor/cache.go index 07a8418..4d929ec 100644 --- a/server/torr/storage/torrstor/cache.go +++ b/server/torr/storage/torrstor/cache.go @@ -80,9 +80,7 @@ func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl { func (c *Cache) Close() error { log.TLogln("Close cache for:", c.hash) - if _, ok := c.storage.caches[c.hash]; ok { - delete(c.storage.caches, c.hash) - } + delete(c.storage.caches, c.hash) c.pieces = nil c.muReaders.Lock() diff --git a/server/torr/torrent.go b/server/torr/torrent.go index 11ac52a..27f8eeb 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -359,9 +359,7 @@ func (t *Torrent) Close() { t.Stat = state.TorrentClosed t.bt.mu.Lock() - if _, ok := t.bt.torrents[t.Hash()]; ok { - delete(t.bt.torrents, t.Hash()) - } + delete(t.bt.torrents, t.Hash()) t.bt.mu.Unlock() t.drop()