Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
fix #113 : a malformed magnet may cause lock unreleased
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Apr 21, 2021
1 parent 9cc5947 commit f0b898b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ func (e *Engine) NewMagnet(magnetURI string) error {
log.Println("[NewMagnet] called: ", magnetURI)
e.RLock()
tt, err := e.client.AddMagnet(magnetURI)
e.RUnlock()
if err != nil {
return err
}
e.RUnlock()
e.newMagnetCacheFile(magnetURI, tt.InfoHash().HexString())
return e.addTorrentTask(tt)
}
Expand All @@ -153,10 +153,10 @@ func (e *Engine) NewTorrentBySpec(spec *torrent.TorrentSpec) error {
log.Println("[NewTorrentBySpec] called ")
e.RLock()
tt, _, err := e.client.AddTorrentSpec(spec)
e.RUnlock()
if err != nil {
return err
}
e.RUnlock()
return e.addTorrentTask(tt)
}

Expand Down

0 comments on commit f0b898b

Please sign in to comment.