From 635ec27fb3666ea2072997666b4d356dde25f7af Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 15 Oct 2020 12:56:06 +1100 Subject: [PATCH] Don't update requests for the current connection first when a request is deleted --- peerconn.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() -- 2.48.1