mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
accounts: fix data race when closing manager
This commit is contained in:
parent
35dd84ce29
commit
9b1680f55c
1 changed files with 4 additions and 3 deletions
|
|
@ -93,9 +93,6 @@ func NewManager(config *Config, backends ...Backend) *Manager {
|
|||
|
||||
// Close terminates the account manager's internal notification processes.
|
||||
func (am *Manager) Close() error {
|
||||
for _, w := range am.wallets {
|
||||
w.Close()
|
||||
}
|
||||
errc := make(chan error)
|
||||
am.quit <- errc
|
||||
return <-errc
|
||||
|
|
@ -149,6 +146,10 @@ func (am *Manager) update() {
|
|||
am.lock.Unlock()
|
||||
close(event.processed)
|
||||
case errc := <-am.quit:
|
||||
// Close all owned wallets
|
||||
for _, w := range am.wallets {
|
||||
w.Close()
|
||||
}
|
||||
// Manager terminating, return
|
||||
errc <- nil
|
||||
// Signals event emitters the loop is not receiving values
|
||||
|
|
|
|||
Loading…
Reference in a new issue