Skip to content

Commit ce2ec19

Browse files
committed
Merge pull request bnb-chain#166 from fjl/fix/mist-quit
Fix Mist Shutdown
2 parents f05d422 + e252dbf commit ce2ec19

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎ethereum.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ func (s *Ethereum) peerHandler(listener net.Listener) {
490490
}
491491

492492
func (s *Ethereum) Stop() {
493+
// Stop eventMux first, it will close all subscriptions.
494+
s.eventMux.Stop()
495+
493496
// Close the database
494497
defer s.db.Close()
495498

@@ -514,7 +517,6 @@ func (s *Ethereum) Stop() {
514517
}
515518
s.txPool.Stop()
516519
s.stateManager.Stop()
517-
s.eventMux.Stop()
518520
s.blockPool.Stop()
519521

520522
ethlogger.Infoln("Server stopped")

‎javascript/javascript_runtime.go‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ type JSRE struct {
2525
Vm *otto.Otto
2626
pipe *ethpipe.JSPipe
2727

28-
events event.Subscription
29-
quitChan chan bool
28+
events event.Subscription
3029

3130
objectCb map[string][]otto.Value
3231
}
@@ -51,7 +50,6 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
5150
otto.New(),
5251
ethpipe.NewJSPipe(ethereum),
5352
nil,
54-
make(chan bool),
5553
make(map[string][]otto.Value),
5654
}
5755

@@ -104,10 +102,6 @@ func (self *JSRE) Require(file string) error {
104102

105103
func (self *JSRE) Stop() {
106104
self.events.Unsubscribe()
107-
// Kill the main loop
108-
self.quitChan <- true
109-
110-
close(self.quitChan)
111105
jsrelogger.Infoln("stopped")
112106
}
113107

0 commit comments

Comments
 (0)