mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 19:24:14 +08:00
fix: batches of blocks have equal priority
addresses... https://github.com/jbenet/go-ipfs/pull/438/files#r21878994 License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:

committed by
Juan Batiz-Benet

parent
bd3ee739b9
commit
8100582e38
@ -3,6 +3,7 @@
|
||||
package bitswap
|
||||
|
||||
import (
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -30,6 +31,8 @@ const (
|
||||
providerRequestTimeout = time.Second * 10
|
||||
hasBlockTimeout = time.Second * 15
|
||||
sizeBatchRequestChan = 32
|
||||
// kMaxPriority is the max priority as defined by the bitswap protocol
|
||||
kMaxPriority = math.MaxInt32
|
||||
)
|
||||
|
||||
var (
|
||||
@ -261,7 +264,7 @@ func (bs *bitswap) clientWorker(parent context.Context) {
|
||||
continue
|
||||
}
|
||||
for i, k := range ks {
|
||||
bs.wantlist.Add(k, len(ks)-i)
|
||||
bs.wantlist.Add(k, kMaxPriority-i)
|
||||
}
|
||||
// NB: send want list to providers for the first peer in this list.
|
||||
// the assumption is made that the providers of the first key in
|
||||
|
Reference in New Issue
Block a user