eth/downloader: close queue after all fetchers finished

This commit is contained in:
4000D 2018-05-21 20:04:47 +09:00
parent 415969f534
commit 7ed11199a0

View file

@ -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
}
}