aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-10-29 20:28:00 +0800
committerFelix Lange <fjl@twurst.com>2015-10-30 00:26:26 +0800
commitfbdb44dcc17240a01b45e55d3aa4e4b8db0868cd (patch)
tree2363ce8738074226cfedf8ede1612e0ef3a03494 /xeth
parent56f8699a6c6bfe613d2ab28c47631a1f4a29e36f (diff)
downloaddexon-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 'xeth')
-rw-r--r--xeth/xeth.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index f1e8cc5ee..35e6dd52d 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -113,19 +113,15 @@ func New(ethereum *eth.Ethereum, frontend Frontend) *XEth {
if frontend == nil {
xeth.frontend = dummyFrontend{}
}
- state, err := xeth.backend.BlockChain().State()
- if err != nil {
- return nil
- }
+ state, _ := xeth.backend.BlockChain().State()
xeth.state = NewState(xeth, state)
-
go xeth.start()
-
return xeth
}
func (self *XEth) start() {
timer := time.NewTicker(2 * time.Second)
+ defer timer.Stop()
done:
for {
select {
@@ -171,8 +167,12 @@ done:
}
}
-func (self *XEth) stop() {
+// Stop releases any resources associated with self.
+// It may not be called more than once.
+func (self *XEth) Stop() {
close(self.quit)
+ self.filterManager.Stop()
+ self.backend.Miner().Unregister(self.agent)
}
func cAddress(a []string) []common.Address {