erigon-pulse/miner
Felix Lange 56ed6152a1 core, eth, miner: improve shutdown synchronisation
Shutting down geth prints hundreds of annoying error messages in some
cases. The errors appear because the Stop method of eth.ProtocolManager,
miner.Miner and core.TxPool is asynchronous. Left over peer sessions
generate events which are processed after Stop even though the database
has already been closed.

The fix is to make Stop synchronous using sync.WaitGroup.

For eth.ProtocolManager, in order to make use of WaitGroup safe, we need
a way to stop new peer sessions from being added while waiting on the
WaitGroup. The eth protocol Run function now selects on a signaling
channel and adds to the WaitGroup only if ProtocolManager is not
shutting down.

For miner.worker and core.TxPool the number of goroutines is static,
WaitGroup can be used in the usual way without additional
synchronisation.
2016-05-09 13:03:08 +02:00
..
agent.go all: Add GPU mining, disabled by default 2015-10-07 13:19:30 +02:00
miner.go core: added basic chain configuration 2016-04-01 01:01:10 +02:00
remote_agent.go miner: synchronise start / stop 2015-10-31 02:18:41 +01:00
worker.go core, eth, miner: improve shutdown synchronisation 2016-05-09 13:03:08 +02:00