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.
This commit is contained in:
@ -133,10 +133,13 @@ func (self *Miner) Register(agent Agent) {
|
||||
if self.Mining() {
|
||||
agent.Start()
|
||||
}
|
||||
|
||||
self.worker.register(agent)
|
||||
}
|
||||
|
||||
func (self *Miner) Unregister(agent Agent) {
|
||||
self.worker.unregister(agent)
|
||||
}
|
||||
|
||||
func (self *Miner) Mining() bool {
|
||||
return atomic.LoadInt32(&self.mining) > 0
|
||||
}
|
||||
@ -146,7 +149,7 @@ func (self *Miner) HashRate() (tot int64) {
|
||||
// do we care this might race? is it worth we're rewriting some
|
||||
// aspects of the worker/locking up agents so we can get an accurate
|
||||
// hashrate?
|
||||
for _, agent := range self.worker.agents {
|
||||
for agent := range self.worker.agents {
|
||||
tot += agent.GetHashRate()
|
||||
}
|
||||
return
|
||||
|
Reference in New Issue
Block a user