diff options
author | obscuren <geffobscura@gmail.com> | 2015-05-11 21:43:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-05-11 23:21:22 +0800 |
commit | 21e52efdfed19c4376b830f8ad0e52a9e599f633 (patch) | |
tree | a3d6f2be23c64881461892572adc9d1b55cd4b39 /miner/worker.go | |
parent | 064cf1609987bb0f6c59c1e790b7811d9a783fef (diff) | |
download | dexon-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.gz dexon-21e52efdfed19c4376b830f8ad0e52a9e599f633.tar.zst dexon-21e52efdfed19c4376b830f8ad0e52a9e599f633.zip |
cmd/geth, miner, backend, xeth: Fixed miner threads to be settable
Miner threads are now settable through the admin interface (closes #897)
and specify 0 CPU worker threads when eth_getWork is called (closes #916)
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/miner/worker.go b/miner/worker.go index e3dbae717..d801a9839 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -141,7 +141,6 @@ func (self *worker) start() { for _, agent := range self.agents { agent.Start() } - } func (self *worker) stop() { @@ -149,10 +148,16 @@ func (self *worker) stop() { defer self.mu.Unlock() if atomic.LoadInt32(&self.mining) == 1 { + var keep []Agent // stop all agents for _, agent := range self.agents { agent.Stop() + // keep all that's not a cpu agent + if _, ok := agent.(*CpuAgent); !ok { + keep = append(keep, agent) + } } + self.agents = keep } atomic.StoreInt32(&self.mining, 0) |