From 5f9740c04e1b9f80b62295e434b0b05536bf3a7f Mon Sep 17 00:00:00 2001 From: ucwong Date: Fri, 3 Apr 2020 08:54:32 +0000 Subject: [PATCH] accounts : fix quit channel goroutine leak --- accounts/keystore/keystore.go | 2 +- accounts/keystore/watch.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index 5b55175b1f..6996575cf5 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -358,7 +358,7 @@ func (ks *KeyStore) TimedUnlock(a accounts.Account, passphrase string, timeout t close(u.abort) } if timeout > 0 { - u = &unlocked{Key: key, abort: make(chan struct{})} + u = &unlocked{Key: key, abort: make(chan struct{}, 1)} go ks.expire(a.Address, u, timeout) } else { u = &unlocked{Key: key} diff --git a/accounts/keystore/watch.go b/accounts/keystore/watch.go index d6ef53327d..36b1bc925e 100644 --- a/accounts/keystore/watch.go +++ b/accounts/keystore/watch.go @@ -37,7 +37,7 @@ func newWatcher(ac *accountCache) *watcher { return &watcher{ ac: ac, ev: make(chan notify.EventInfo, 10), - quit: make(chan struct{}), + quit: make(chan struct{}, 1), } }