aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/netstore.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-09-27 15:43:00 +0800
committerJanos Guljas <janos@resenje.org>2018-09-27 15:43:00 +0800
commita5e6bf7eefbe6f56cf688b3542fe373c4670cb65 (patch)
tree8b712ef8fb72b354346c7b1092261c469ebd7d8a /swarm/storage/netstore.go
parent0d5e1e7bc9ad4044a679ab5429d118b2a0e8afe7 (diff)
parente39a9b3480af0ac8044294f46e0e9e4c3948d23c (diff)
downloaddexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.gz
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.bz2
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.lz
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.xz
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.zst
dexon-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.zip
Merge branch 'master' into max-stream-peer-servers
Diffstat (limited to 'swarm/storage/netstore.go')
-rw-r--r--swarm/storage/netstore.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go
index a3a552232..16bc48a9a 100644
--- a/swarm/storage/netstore.go
+++ b/swarm/storage/netstore.go
@@ -34,7 +34,7 @@ type (
)
type NetFetcher interface {
- Request(ctx context.Context)
+ Request(ctx context.Context, hopCount uint8)
Offer(ctx context.Context, source *enode.ID)
}
@@ -263,6 +263,9 @@ func (f *fetcher) Fetch(rctx context.Context) (Chunk, error) {
// If there is a source in the context then it is an offer, otherwise a request
sourceIF := rctx.Value("source")
+
+ hopCount, _ := rctx.Value("hopcount").(uint8)
+
if sourceIF != nil {
var source enode.ID
if err := source.UnmarshalText([]byte(sourceIF.(string))); err != nil {
@@ -270,7 +273,7 @@ func (f *fetcher) Fetch(rctx context.Context) (Chunk, error) {
}
f.netFetcher.Offer(rctx, &source)
} else {
- f.netFetcher.Request(rctx)
+ f.netFetcher.Request(rctx, hopCount)
}
// wait until either the chunk is delivered or the context is done