From 1d53c170b09f7c1dae472b684774e8f1f4b1bf70 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 17 Jul 2021 19:10:07 +1000 Subject: [PATCH] Close torrent storage asynchronously on drop --- storage/sqlite-piece-completion.go | 1 - torrent.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/storage/sqlite-piece-completion.go b/storage/sqlite-piece-completion.go index 857b97a2..196f1e50 100644 --- a/storage/sqlite-piece-completion.go +++ b/storage/sqlite-piece-completion.go @@ -64,7 +64,6 @@ func (me *sqlitePieceCompletion) Close() (err error) { defer me.mu.Unlock() if me.db != nil { err = me.db.Close() - me.db = nil } return } diff --git a/torrent.go b/torrent.go index ab11a2e3..5c77aa39 100644 --- a/torrent.go +++ b/torrent.go @@ -799,7 +799,7 @@ func (t *Torrent) close() (err error) { t.closed.Set() t.tickleReaders() if t.storage != nil { - func() { + go func() { t.storageLock.Lock() defer t.storageLock.Unlock() if f := t.storage.Close; f != nil {