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.
|
// Wait for the first error, then terminate the others.
|
||||||
var err error
|
var err error
|
||||||
for i := 0; i < len(fetchers); i++ {
|
for i := 0; i < len(fetchers); i++ {
|
||||||
|
err = <-errc
|
||||||
|
|
||||||
if i == len(fetchers)-1 {
|
if i == len(fetchers)-1 {
|
||||||
// Close the queue when all fetchers have exited.
|
// Close the queue when all fetchers have exited.
|
||||||
// This will cause the block processor to end when
|
// This will cause the block processor to end when
|
||||||
// it has processed the queue.
|
// it has processed the queue.
|
||||||
d.queue.Close()
|
d.queue.Close()
|
||||||
}
|
}
|
||||||
if err = <-errc; err != nil {
|
|
||||||
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue