diff options
author | Felix Lange <fjl@twurst.com> | 2015-11-14 00:08:15 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-11-19 21:18:34 +0800 |
commit | 900da3d800ad299c22ecb5d14f477600931d70b6 (patch) | |
tree | ba63e738bd44c77a1c161cf906ddab374beb8f43 /eth/downloader/events.go | |
parent | 9422eec55460aaca300cabd52124ed0cbd8dedd3 (diff) | |
download | dexon-900da3d800ad299c22ecb5d14f477600931d70b6.tar.gz dexon-900da3d800ad299c22ecb5d14f477600931d70b6.tar.zst dexon-900da3d800ad299c22ecb5d14f477600931d70b6.zip |
eth/downloader: don't hang for spurious deliveries
Unexpected deliveries could block indefinitely if they arrived at the
right time. The fix is to ensure that the cancellation channel is
always closed when the sync ends, unblocking any deliveries. Also remove
the atomic check for whether a sync is currently running because it
doesn't help and can be misleading.
Cancelling always seems to break the tests though. The downloader
spawned d.process whenever new data arrived, making it somewhat hard to
track when block processing was actually done. Fix this by running
d.process in a dedicated goroutine that is tied to the lifecycle of the
sync. d.process gets notified of new work by the queue instead of being
invoked all the time. This removes a ton of weird workaround code,
including a hairy use of atomic CAS.
Diffstat (limited to 'eth/downloader/events.go')
0 files changed, 0 insertions, 0 deletions