Skip to content

Commit

Permalink
zero desired requests on close
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jul 22, 2024
1 parent 9f65af9 commit 9f8d405
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ func (p *Peer) close(lockTorrent bool) {
if p.t != nil {
p.t.decPeerPieceAvailability(p, false, false)
}

p.desiredRequestLen = 0

for _, f := range p.callbacks.PeerClosed {
f(p)
}
Expand Down Expand Up @@ -1138,6 +1141,7 @@ func (p *Peer) desiredRequests(lock bool) int {
p.mu.RLock()
defer p.mu.RUnlock()
}

return p.desiredRequestLen
}

Expand Down
2 changes: 1 addition & 1 deletion webseed-peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func requestUpdate(ws *webseedPeer) {
if p == &ws.peer {
this = "*"
}
flags := p.connectionFlags()
flags := p.StatusFlags()
peerInfo = append(peerInfo, fmt.Sprintf("%s%s:p=%d,d=%d: %f", this, flags, pieces, desired, rate))

}, false)
Expand Down

0 comments on commit 9f8d405

Please sign in to comment.