Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
dvovk committed Dec 5, 2024
1 parent 3bee769 commit 0466376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions webseed-peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions webseed/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0466376

Please sign in to comment.