Commit 4fd7da03 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

fix: batches of blocks have equal priority

addresses...

https://github.com/jbenet/go-ipfs/pull/438/files#r21878994

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 74d13f3c
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment