Fix cancellation for global requesting
This commit is contained in:
parent
63f3e8d3de
commit
110b6f3fd3
|
@ -4,6 +4,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/RoaringBitmap/roaring"
|
||||||
"github.com/anacrolix/missinggo/v2/bitmap"
|
"github.com/anacrolix/missinggo/v2/bitmap"
|
||||||
|
|
||||||
"github.com/anacrolix/chansync"
|
"github.com/anacrolix/chansync"
|
||||||
|
@ -208,12 +209,10 @@ func (p *Peer) applyNextRequestState() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
more := true
|
more := true
|
||||||
current.Requests.Iterate(func(req uint32) bool {
|
cancel := roaring.AndNot(¤t.Requests, &next.Requests)
|
||||||
if !next.Requests.Contains(req) {
|
cancel.Iterate(func(req uint32) bool {
|
||||||
more = p.cancel(req)
|
more = p.cancel(req)
|
||||||
return more
|
return more
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
})
|
||||||
if !more {
|
if !more {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue