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>
Brian Tiger Chow committed
Dec 17, 2014 at 03:37 UTC
8100582e387d8a0fd1cdbeabcc41ea15dba7f05d
1 file changed
+4
-1
exchange/bitswap/bitswap.go
+4
-1
@@ -3,6 +3,7 @@
3
package bitswap
4
5
import (
6
+ "math"
7
"sync"
8
"time"
9
@@ -30,6 +31,8 @@ const (
31
providerRequestTimeout = time.Second * 10
32
hasBlockTimeout = time.Second * 15
33
sizeBatchRequestChan = 32
34
+ // kMaxPriority is the max priority as defined by the bitswap protocol
35
+ kMaxPriority = math.MaxInt32
36
)
37
38
var (
@@ -261,7 +264,7 @@ func (bs *bitswap) clientWorker(parent context.Context) {
264
continue
265
}
266
for i, k := range ks {
264
- bs.wantlist.Add(k, len(ks)-i)
267
+ bs.wantlist.Add(k, kMaxPriority-i)
268
}
269
// NB: send want list to providers for the first peer in this list.
270
// the assumption is made that the providers of the first key in