mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
eth/syncer: respect close signal during retry backoff
This commit is contained in:
parent
0cba803fba
commit
4361057d42
1 changed files with 6 additions and 1 deletions
|
|
@ -117,7 +117,12 @@ func (s *Syncer) run() {
|
||||||
logged = true
|
logged = true
|
||||||
log.Info("Waiting for peers to retrieve sync target", "hash", req.hash)
|
log.Info("Waiting for peers to retrieve sync target", "hash", req.hash)
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second * time.Duration(retries+1))
|
select {
|
||||||
|
case <-time.After(time.Second * time.Duration(retries+1)):
|
||||||
|
case <-s.closed:
|
||||||
|
req.errc <- errors.New("syncer closed")
|
||||||
|
return
|
||||||
|
}
|
||||||
retries++
|
retries++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue