diff --git a/peer.go b/peer.go index 501659b938..32c30e3e91 100644 --- a/peer.go +++ b/peer.go @@ -1017,9 +1017,7 @@ func (c *Peer) deleteRequest(r RequestIndex, lock bool, lockTorrent bool) bool { defer c.mu.Unlock() } - removed := c.requestState.Requests.CheckedRemove(r) - - if !removed { + if !c.requestState.Requests.CheckedRemove(r) { return false } diff --git a/webseed-peer.go b/webseed-peer.go index 599fe990c7..0e55d86dc6 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -446,14 +446,13 @@ func requestUpdate(ws *webseedPeer) { rate := p.downloadRate() pieces := p.uncancelledRequests(false) desired := p.desiredRequests(false) - banCount := p.banCount this := "" if p == &ws.peer { this = "*" } flags := p.StatusFlags() - peerInfo = append(peerInfo, fmt.Sprintf("%s%s:p=%d,d=%d,bc=%d: %f", this, flags, pieces, desired, banCount, rate)) + peerInfo = append(peerInfo, fmt.Sprintf("%s%s:p=%d,d=%d: %f", this, flags, pieces, desired, rate)) }, false) @@ -573,8 +572,6 @@ func (ws *webseedPeer) requestResultHandler(r Request, webseedRequest *webseed.R } if ws.peer.t.closed.IsSet() { - //log - ws.peer.logger.Printf("closed %v", ws) return nil } @@ -585,8 +582,6 @@ func (ws *webseedPeer) requestResultHandler(r Request, webseedRequest *webseed.R err = result.Ctx.Err() } - reqIdx := ws.peer.t.requestIndexFromRequest(r, true) - if err != nil { switch { case errors.Is(err, context.Canceled): @@ -604,7 +599,7 @@ func (ws *webseedPeer) requestResultHandler(r Request, webseedRequest *webseed.R } } - if !ws.peer.remoteRejectedRequest(reqIdx, true, true) { + if !ws.peer.remoteRejectedRequest(ws.peer.t.requestIndexFromRequest(r, true), true, true) { err = fmt.Errorf(`received invalid reject "%w", for request %v`, err, r) ws.peer.logger.Levelf(log.Debug, "%v", err) }