Break up long condition expression
This commit is contained in:
parent
70ce33cab3
commit
6e8634e971
|
@ -260,7 +260,14 @@ func (p *Peer) applyRequestState(next desiredRequestState) {
|
||||||
|
|
||||||
t := p.t
|
t := p.t
|
||||||
originalRequestCount := current.Requests.GetCardinality()
|
originalRequestCount := current.Requests.GetCardinality()
|
||||||
for requestHeap.Len() != 0 && maxRequests(current.Requests.GetCardinality()+current.Cancelled.GetCardinality()) < p.nominalMaxRequests() {
|
for {
|
||||||
|
if requestHeap.Len() == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
numPending := maxRequests(current.Requests.GetCardinality() + current.Cancelled.GetCardinality())
|
||||||
|
if numPending >= p.nominalMaxRequests() {
|
||||||
|
break
|
||||||
|
}
|
||||||
req := heap.Pop(requestHeap)
|
req := heap.Pop(requestHeap)
|
||||||
existing := t.requestingPeer(req)
|
existing := t.requestingPeer(req)
|
||||||
if existing != nil && existing != p {
|
if existing != nil && existing != p {
|
||||||
|
|
Loading…
Reference in New Issue