]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Don't update requests for the current connection first when a request is deleted
authorMatt Joiner <anacrolix@gmail.com>
Thu, 15 Oct 2020 01:56:06 +0000 (12:56 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 15 Oct 2020 01:56:06 +0000 (12:56 +1100)
peerconn.go

index c9a050a5cd7957b8c46624951ddf59bbf9912a11..c6019d29f078630c76a6e9c87a49e1b1a3333472 100644 (file)
@@ -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()