aboutsummaryrefslogtreecommitdiffstats
path: root/miner/remote_agent.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-10-30 00:42:55 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-10-30 00:42:55 +0800
commitfc46cf337af614f4f9c96acd222089652fe7c76e (patch)
tree672ce52e11b768801f0b33f224424ba5f0fdc465 /miner/remote_agent.go
parentfd27f074feecec2f1e4c8041ff04ddac8d0ab6a3 (diff)
parentfbdb44dcc17240a01b45e55d3aa4e4b8db0868cd (diff)
downloaddexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar.gz
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar.bz2
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar.lz
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar.xz
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.tar.zst
dexon-fc46cf337af614f4f9c96acd222089652fe7c76e.zip
Merge pull request #1946 from fjl/xeth-oom
Fix for xeth OOM issue
Diffstat (limited to 'miner/remote_agent.go')
-rw-r--r--miner/remote_agent.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/miner/remote_agent.go b/miner/remote_agent.go
index 9e4453ce8..18ddf121c 100644
--- a/miner/remote_agent.go
+++ b/miner/remote_agent.go
@@ -48,9 +48,10 @@ type RemoteAgent struct {
}
func NewRemoteAgent() *RemoteAgent {
- agent := &RemoteAgent{work: make(map[common.Hash]*Work), hashrate: make(map[common.Hash]hashrate)}
-
- return agent
+ return &RemoteAgent{
+ work: make(map[common.Hash]*Work),
+ hashrate: make(map[common.Hash]hashrate),
+ }
}
func (a *RemoteAgent) SubmitHashrate(id common.Hash, rate uint64) {
@@ -75,8 +76,12 @@ func (a *RemoteAgent) Start() {
}
func (a *RemoteAgent) Stop() {
- close(a.quit)
- close(a.workCh)
+ if a.quit != nil {
+ close(a.quit)
+ }
+ if a.workCh != nil {
+ close(a.workCh)
+ }
}
// GetHashRate returns the accumulated hashrate of all identifier combined