Merge remote-tracking branch 'origin/master'

This commit is contained in:
YouROK
2021-05-08 21:55:40 +03:00
5 changed files with 6 additions and 11 deletions

View File

@@ -101,9 +101,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()

View File

@@ -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()