mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: increase search timeout to 3sec.
This commit is contained in:
parent
0e310a937a
commit
273ec941fb
3 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue