提交 f857fb76 编写于 作者: P Péter Szilágyi

eth/downloader: fix a rare test race on the OSX CI

上级 9f6016e8
......@@ -83,7 +83,13 @@ func newTester() *downloadTester {
// sync starts synchronizing with a remote peer, blocking until it completes.
func (dl *downloadTester) sync(id string) error {
err := dl.downloader.synchronise(id, dl.peerHashes[id][0])
for atomic.LoadInt32(&dl.downloader.processing) == 1 {
for {
// If the queue is empty and processing stopped, break
hashes, blocks := dl.downloader.queue.Size()
if hashes+blocks == 0 && atomic.LoadInt32(&dl.downloader.processing) == 0 {
break
}
// Otherwise sleep a bit and retry
time.Sleep(time.Millisecond)
}
return err
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册