mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
account: fix timer leak
This commit is contained in:
parent
15d09038a6
commit
61fa179dd5
1 changed files with 4 additions and 1 deletions
|
|
@ -185,13 +185,16 @@ func (w *wallet) heartbeat() {
|
|||
errc chan error
|
||||
err error
|
||||
)
|
||||
|
||||
timer := time.NewTicker(heartbeatCycle)
|
||||
defer timer.Stop()
|
||||
for errc == nil && err == nil {
|
||||
// Wait until termination is requested or the heartbeat cycle arrives
|
||||
select {
|
||||
case errc = <-w.healthQuit:
|
||||
// Termination requested
|
||||
continue
|
||||
case <-time.After(heartbeatCycle):
|
||||
case <-timer.C:
|
||||
// Heartbeat time
|
||||
}
|
||||
// Execute a tiny data exchange to see responsiveness
|
||||
|
|
|
|||
Loading…
Reference in a new issue