diff options
author | Felix Lange <fjl@twurst.com> | 2015-10-29 20:28:00 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-10-30 00:26:26 +0800 |
commit | fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd (patch) | |
tree | 2363ce8738074226cfedf8ede1612e0ef3a03494 /miner/remote_agent.go | |
parent | 56f8699a6c6bfe613d2ab28c47631a1f4a29e36f (diff) | |
download | dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar.gz dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar.bz2 dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar.lz dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar.xz dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.tar.zst dexon-fbdb44dcc17240a01b45e55d3aa4e4b8db0868cd.zip |
cmd/utils, rpc/comms: stop XEth when IPC connection ends
There are a bunch of changes required to make this work:
- in miner: allow unregistering agents, fix RemoteAgent.Stop
- in eth/filters: make FilterSystem.Stop not crash
- in rpc/comms: move listen loop to platform-independent code
Fixes #1930. I ran the shell loop there for a few minutes and didn't see
any changes in the memory profile.
Diffstat (limited to 'miner/remote_agent.go')
-rw-r--r-- | miner/remote_agent.go | 15 |
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 |