mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge pull request #2 from Charroja/deepsource-fix-436d8fe4
Remove unnecessary guard around `delete`
This commit is contained in:
@@ -80,9 +80,7 @@ func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl {
|
|||||||
|
|
||||||
func (c *Cache) Close() error {
|
func (c *Cache) Close() error {
|
||||||
log.TLogln("Close cache for:", c.hash)
|
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.pieces = nil
|
||||||
|
|
||||||
c.muReaders.Lock()
|
c.muReaders.Lock()
|
||||||
|
|||||||
@@ -359,9 +359,7 @@ func (t *Torrent) Close() {
|
|||||||
t.Stat = state.TorrentClosed
|
t.Stat = state.TorrentClosed
|
||||||
|
|
||||||
t.bt.mu.Lock()
|
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.bt.mu.Unlock()
|
||||||
|
|
||||||
t.drop()
|
t.drop()
|
||||||
|
|||||||
Reference in New Issue
Block a user