From: Matt Joiner Date: Thu, 15 Oct 2020 01:56:06 +0000 (+1100) Subject: Don't update requests for the current connection first when a request is deleted X-Git-Tag: v1.18.0~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=635ec27fb3666ea2072997666b4d356dde25f7af;p=btrtrc.git Don't update requests for the current connection first when a request is deleted --- diff --git a/peerconn.go b/peerconn.go index c9a050a5..c6019d29 100644 --- a/peerconn.go +++ b/peerconn.go @@ -1497,7 +1497,12 @@ func (c *peer) deleteRequest(r request) bool { if n < 0 { panic(n) } - c.updateRequests() + // If a request is rejected, updating the requests for the current peer first will miss the + // opportunity to try other peers for that request instead. I'm not sure about the interested + // check in the following loop however. + if false { + c.updateRequests() + } c.t.iterPeers(func(_c *peer) { if !_c.interested && _c != c && c.peerHasPiece(pieceIndex(r.Index)) { _c.updateRequests()