Merge pull request #48 from Charroja/master

Fix anti-pattern
This commit is contained in:
YouROK
2021-05-07 22:38:31 +03:00
committed by GitHub
5 changed files with 6 additions and 11 deletions

View File

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