mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
eth/downloader: close queue after all fetchers finished
This commit is contained in:
parent
415969f534
commit
7ed11199a0
1 changed files with 4 additions and 1 deletions
|
|
@ -486,13 +486,16 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
|
|||
// Wait for the first error, then terminate the others.
|
||||
var err error
|
||||
for i := 0; i < len(fetchers); i++ {
|
||||
err = <-errc
|
||||
|
||||
if i == len(fetchers)-1 {
|
||||
// Close the queue when all fetchers have exited.
|
||||
// This will cause the block processor to end when
|
||||
// it has processed the queue.
|
||||
d.queue.Close()
|
||||
}
|
||||
if err = <-errc; err != nil {
|
||||
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue