diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-05-31 19:48:52 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-05-31 19:48:52 +0800 |
commit | 16a23ff74056aa306eb8a87272277bc8660f3252 (patch) | |
tree | 811c5baa8451f5a13e16c7fe033a20e67df12629 /eth/downloader/downloader_test.go | |
parent | 1d5d21726a49a1dcf06d0d1544e1bd93f4231632 (diff) | |
parent | 4496a44f68246bf128bb822c3f3a98f38adfdbdd (diff) | |
download | go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar.gz go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar.bz2 go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar.lz go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar.xz go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.tar.zst go-tangerine-16a23ff74056aa306eb8a87272277bc8660f3252.zip |
Merge pull request #2637 from karalabe/downloader-always-cancel
eth/downloader: ensure cancel channel is closed post sync
Diffstat (limited to 'eth/downloader/downloader_test.go')
-rw-r--r-- | eth/downloader/downloader_test.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 4ea8a8abe..1cf0e7cd3 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -188,7 +188,17 @@ func (dl *downloadTester) sync(id string, td *big.Int, mode SyncMode) error { } } dl.lock.RUnlock() - return dl.downloader.synchronise(id, hash, td, mode) + + // Synchronise with the chosen peer and ensure proper cleanup afterwards + err := dl.downloader.synchronise(id, hash, td, mode) + select { + case <-dl.downloader.cancelCh: + // Ok, downloader fully cancelled after sync cycle + default: + // Downloader is still accepting packets, can block a peer up + panic("downloader active post sync cycle") // panic will be caught by tester + } + return err } // hasHeader checks if a header is present in the testers canonical chain. |