diff --git a/webseed-peer.go b/webseed-peer.go index 81f5eba0ea..0275ad8f2e 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -97,10 +97,9 @@ func (ws *webseedPeer) _cancel(r RequestIndex, lock bool, lockTorrent bool) bool ws.peer.mu.RLock() defer ws.peer.mu.RUnlock() } - - active.Cancel() + // The requester is running and will handle the result. - return true + return active.Cancel() } // There should be no requester handling this, so no further events will occur. return false diff --git a/webseed/client.go b/webseed/client.go index e28c050eef..72f46bab88 100644 --- a/webseed/client.go +++ b/webseed/client.go @@ -37,16 +37,18 @@ type Request struct { Result chan RequestResult } -func (r *Request) Cancel() { +func (r *Request) Cancel() bool { r.cancel() r.Lock() - hasResult := r.Result == nil + hasResult := r.Result != nil r.Unlock() - if hasResult { + if !hasResult { r.onCancelled() } + + return hasResult } type Client struct {