requesting.go | 7 +++---- diff --git a/requesting.go b/requesting.go index 74d1d682e317261b7fc6b5d9b483d14071a1d836..669b0d2a78b30cedcc2bca7ac04bde0a594906f0 100644 --- a/requesting.go +++ b/requesting.go @@ -214,6 +214,7 @@ return } allowedFast := p.peerAllowedFast.ContainsInt(pieceIndex) rsp.IterPendingChunks.Iter(func(ci request_strategy.ChunkIndex) { + r := p.t.pieceRequestIndexOffset(pieceIndex) + ci if !allowedFast { // We must signal interest to request this desired.Interested = true @@ -221,14 +222,12 @@ // We can make or will allow sustaining a request here if we're not choked, or // have made the request previously (presumably while unchoked), and haven't had // the peer respond yet (and the request was retained because we are using the // fast extension). - if p.peerChoking && !p.actualRequestState.Requests.Contains(ci) { + if p.peerChoking && !p.actualRequestState.Requests.Contains(r) { // We can't request this right now. return } } - requestHeap.requestIndexes = append( - requestHeap.requestIndexes, - p.t.pieceRequestIndexOffset(pieceIndex)+ci) + requestHeap.requestIndexes = append(requestHeap.requestIndexes, r) }) }, )