From: Matt Joiner Date: Thu, 16 Sep 2021 07:10:07 +0000 (+1000) Subject: requesting: Remove some obsoleted condition checks X-Git-Tag: v1.32.0~39 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c6fb0535d4f6148acdc262fe91390f76e630af68;p=btrtrc.git requesting: Remove some obsoleted condition checks These shouldn't be necessary since peers were pruned for the ability to allocate chunks to the current piece. --- diff --git a/request-strategy/order.go b/request-strategy/order.go index 9b81a948..8b4b6799 100644 --- a/request-strategy/order.go +++ b/request-strategy/order.go @@ -311,9 +311,7 @@ func allocatePendingChunks(p requestablePiece, peers []*requestsPeer) { } defer func() { for _, peer := range peersForPiece { - if peer.canRequestPiece(p.index) { - peer.requestablePiecesRemaining-- - } + peer.requestablePiecesRemaining-- } peersForPiecesPool.Put(peersForPiece) }() @@ -338,9 +336,6 @@ func allocatePendingChunks(p requestablePiece, peers []*requestsPeer) { if !peer.canFitRequest() { continue } - if !peer.canRequestPiece(p.index) { - continue - } preallocated[spec] = append(preallocated[spec], peer) peer.addNextRequest(req) } @@ -357,9 +352,6 @@ func allocatePendingChunks(p requestablePiece, peers []*requestsPeer) { if !peer.canFitRequest() { continue } - if !peer.HasPiece(p.index) { - continue - } if !peer.pieceAllowedFastOrDefault(p.index) { // TODO: Verify that's okay to stay uninterested if we request allowed fast pieces. peer.nextState.Interested = true @@ -386,9 +378,6 @@ chunk: if !peer.canFitRequest() { continue } - if !peer.HasPiece(p.index) { - continue - } if !peer.pieceAllowedFastOrDefault(p.index) { // TODO: Verify that's okay to stay uninterested if we request allowed fast pieces. peer.nextState.Interested = true