diff options
author | lash <nolash@users.noreply.github.com> | 2019-02-08 23:57:48 +0800 |
---|---|---|
committer | Anton Evangelatov <anton.evangelatov@gmail.com> | 2019-02-08 23:57:48 +0800 |
commit | 0c10d376066cb7e57d3bfc03f950c7750cd90640 (patch) | |
tree | 75a11607a3865e455e2cd98401564e77524921f1 /swarm/network/stream/delivery.go | |
parent | 0436412412d59ac087b7861d49dab35f07e59d33 (diff) | |
download | go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar.gz go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar.bz2 go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar.lz go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar.xz go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.tar.zst go-tangerine-0c10d376066cb7e57d3bfc03f950c7750cd90640.zip |
swarm/network, swarm/storage: Preserve opentracing contexts (#19022)
Diffstat (limited to 'swarm/network/stream/delivery.go')
-rw-r--r-- | swarm/network/stream/delivery.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/swarm/network/stream/delivery.go b/swarm/network/stream/delivery.go index 988afcce8..fae6994f0 100644 --- a/swarm/network/stream/delivery.go +++ b/swarm/network/stream/delivery.go @@ -144,7 +144,6 @@ func (d *Delivery) handleRetrieveRequestMsg(ctx context.Context, sp *Peer, req * ctx, osp = spancontext.StartSpan( ctx, "retrieve.request") - defer osp.Finish() s, err := sp.getServer(NewStream(swarmChunkServerStreamName, "", true)) if err != nil { @@ -167,6 +166,7 @@ func (d *Delivery) handleRetrieveRequestMsg(ctx context.Context, sp *Peer, req * }() go func() { + defer osp.Finish() chunk, err := d.chunkStore.Get(ctx, req.Addr) if err != nil { retrieveChunkFail.Inc(1) @@ -213,11 +213,12 @@ func (d *Delivery) handleChunkDeliveryMsg(ctx context.Context, sp *Peer, req *Ch ctx, osp = spancontext.StartSpan( ctx, "chunk.delivery") - defer osp.Finish() processReceivedChunksCount.Inc(1) go func() { + defer osp.Finish() + req.peer = sp err := d.chunkStore.Put(ctx, storage.NewChunk(req.Addr, req.SData)) if err != nil { @@ -271,7 +272,7 @@ func (d *Delivery) RequestFromPeers(ctx context.Context, req *network.Request) ( Addr: req.Addr, SkipCheck: req.SkipCheck, HopCount: req.HopCount, - }, Top) + }, Top, "request.from.peers") if err != nil { return nil, nil, err } |