This fix a situation where peers might be dropping our requests, and since we depend on all requests being satisfied before re-requesting, we get stuck waiting for the request to be filled.
requestHeap := &next.Requests
t := p.t
heap.Init(requestHeap)
- for requestHeap.Len() != 0 && maxRequests(current.Requests.GetCardinality()) < p.nominalMaxRequests() {
+ for requestHeap.Len() != 0 && maxRequests(current.Requests.GetCardinality()+current.Cancelled.GetCardinality()) < p.nominalMaxRequests() {
req := heap.Pop(requestHeap).(RequestIndex)
existing := t.requestingPeer(req)
if existing != nil && existing != p {