From b7cc43783b6bac759dd3ca04dd3d84817db51e07 Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 1 Apr 2020 11:23:08 +0800 Subject: [PATCH 1/3] whisper/whisperv6 | defer expire ticker stop added --- whisper/whisperv6/whisper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/whisper/whisperv6/whisper.go b/whisper/whisperv6/whisper.go index a7787ca69f39..d5e76d994c9a 100644 --- a/whisper/whisperv6/whisper.go +++ b/whisper/whisperv6/whisper.go @@ -894,6 +894,7 @@ func (whisper *Whisper) processQueue() { func (whisper *Whisper) update() { // Start a ticker to check for expirations expire := time.NewTicker(expirationCycle) + defer expire.Stop() // Repeat updates until termination is requested for { From 9dc4e9a8dd65d2cda657b3d41a23c65a78f0c8f6 Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 1 Apr 2020 11:42:13 +0800 Subject: [PATCH 2/3] cmd/wnode | fix ticker stop in wnode --- cmd/wnode/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go index 968f1fd49f6f..a94ed947d075 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 { From a7ccb9b2e37c4f847b42a6061655f8e3660d338c Mon Sep 17 00:00:00 2001 From: ucwong Date: Wed, 1 Apr 2020 12:07:38 +0800 Subject: [PATCH 3/3] cmd/devp2p | crawl timer stop defer added --- cmd/devp2p/crawl.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/devp2p/crawl.go b/cmd/devp2p/crawl.go index 92aaad72a372..7fefbd7a1c9a 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) }