From 273ec941fb4921e0fa994820b43bb2cb2108b827 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Mon, 11 Mar 2019 17:34:43 +0100 Subject: [PATCH] swarm/network: increase search timeout to 3sec. --- swarm/network/fetcher.go | 4 ++-- swarm/network/stream/delivery.go | 2 +- swarm/storage/netstore.go | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/swarm/network/fetcher.go b/swarm/network/fetcher.go index 74aa191021..31c8d72a17 100644 --- a/swarm/network/fetcher.go +++ b/swarm/network/fetcher.go @@ -30,7 +30,7 @@ import ( ) const ( - defaultSearchTimeout = 1 * time.Second + defaultSearchTimeout = 3 * time.Second // maximum number of forwarded requests (hops), to make sure requests are not // forwarded forever in peer loops maxHopCount uint8 = 20 @@ -272,7 +272,6 @@ func (f *Fetcher) run(peers *sync.Map) { // * the peer's address is removed from prospective sources, and // * a go routine is started that reports on the gone channel if the peer is disconnected (or terminated their streamer) func (f *Fetcher) doRequest(gone chan *enode.ID, peersToSkip *sync.Map, sources []*enode.ID, hopCount uint8) ([]*enode.ID, error) { - log.Trace("fetcher.doRequest", "request addr", f.addr) var i int var sourceID *enode.ID @@ -290,6 +289,7 @@ func (f *Fetcher) doRequest(gone chan *enode.ID, peersToSkip *sync.Map, sources for i = 0; i < len(sources); i++ { req.Source = sources[i] var err error + log.Trace("fetcher.doRequest", "request addr", f.addr, "peer", req.Source.String()) sourceID, quit, err = f.protoRequestFunc(f.ctx, req) if err == nil { // remove the peer from known sources diff --git a/swarm/network/stream/delivery.go b/swarm/network/stream/delivery.go index 1266a9d11c..d4799e87cd 100644 --- a/swarm/network/stream/delivery.go +++ b/swarm/network/stream/delivery.go @@ -228,7 +228,7 @@ func (d *Delivery) handleChunkDeliveryMsg(ctx context.Context, sp *Peer, req *Ch spanId := fmt.Sprintf("stream.send.request.%v.%v", sp.ID(), req.Addr) span := tracing.ShiftSpanByKey(spanId) - log.Trace("handle.chunk.delivery", "ref", req.Addr) + log.Trace("handle.chunk.delivery", "ref", req.Addr, "from peer", sp.ID()) go func() { defer osp.Finish() diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go index e3845489e5..7a2c2d1746 100644 --- a/swarm/storage/netstore.go +++ b/swarm/storage/netstore.go @@ -87,7 +87,9 @@ func (n *NetStore) Put(ctx context.Context, ch Chunk) error { // if chunk is now put in the store, check if there was an active fetcher and call deliver on it // (this delivers the chunk to requestors via the fetcher) + log.Debug("n.getFetcher", "ref", ch.Address()) if f := n.getFetcher(ch.Address()); f != nil { + log.Debug("n.getFetcher deliver", "ref", ch.Address()) f.deliver(ctx, ch) } return nil @@ -341,5 +343,6 @@ func (f *fetcher) deliver(ctx context.Context, ch Chunk) { f.chunk = ch // closing the deliveredC channel will terminate ongoing requests close(f.deliveredC) + log.Debug("n.getFetcher close deliveredC", "ref", ch.Address()) }) }