aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-07-03 19:22:14 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-07-03 19:22:14 +0800
commit03129e7c93a4705eb159a2dacbab6e3755fe02ed (patch)
tree2e2f02177488637b9ba202127ce962309cbe2636 /eth
parent9f6016e8773f951c5b81b30c0257350e2a9c8e5f (diff)
parentf857fb7600f586ad9bfd037091420f77137c973f (diff)
downloadgo-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar.gz
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar.bz2
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar.lz
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar.xz
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.tar.zst
go-tangerine-03129e7c93a4705eb159a2dacbab6e3755fe02ed.zip
Merge pull request #1390 from karalabe/fix-downloader-test-race
eth/downloader: fix a rare test race on the OSX CI
Diffstat (limited to 'eth')
-rw-r--r--eth/downloader/downloader_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go
index c5fb00289..23549a9ba 100644
--- a/eth/downloader/downloader_test.go
+++ b/eth/downloader/downloader_test.go
@@ -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