From 1e2e1b41f8cf0c51f53dd064a4caa75faee14065 Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 1 Apr 2020 22:12:01 +0800 Subject: [PATCH] cmd/devp2p, cmd/wnode, whisper: add missing calls to Timer.Stop (#20843) --- cmd/devp2p/crawl.go | 1 + cmd/wnode/main.go | 1 + whisper/whisperv6/whisper.go | 1 + 3 files changed, 3 insertions(+) diff --git a/cmd/devp2p/crawl.go b/cmd/devp2p/crawl.go index 92aaad72a3..7fefbd7a1c 100644 --- a/cmd/devp2p/crawl.go +++ b/cmd/devp2p/crawl.go @@ -63,6 +63,7 @@ func (c *crawler) run(timeout time.Duration) nodeSet { doneCh = make(chan enode.Iterator, len(c.iters)) liveIters = len(c.iters) ) + defer timeoutTimer.Stop() for _, it := range c.iters { go c.runIterator(doneCh, it) } diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go index 968f1fd49f..a94ed947d0 100644 --- a/cmd/wnode/main.go +++ b/cmd/wnode/main.go @@ -599,6 +599,7 @@ func messageLoop() { } ticker := time.NewTicker(time.Millisecond * 50) + defer ticker.Stop() for { select { diff --git a/whisper/whisperv6/whisper.go b/whisper/whisperv6/whisper.go index e9c872a990..377406b360 100644 --- a/whisper/whisperv6/whisper.go +++ b/whisper/whisperv6/whisper.go @@ -905,6 +905,7 @@ func (whisper *Whisper) update() { defer whisper.wg.Done() // Start a ticker to check for expirations expire := time.NewTicker(expirationCycle) + defer expire.Stop() // Repeat updates until termination is requested for {