Close torrent storage asynchronously on drop

This commit is contained in:
Matt Joiner 2021-07-17 19:10:07 +10:00
parent 5eab39001f
commit 1d53c170b0
2 changed files with 1 additions and 2 deletions

View File

@ -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
}

View File

@ -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 {