From c87cdd30532f5512c8335fd13204f57e11263427 Mon Sep 17 00:00:00 2001 From: ucwong Date: Thu, 2 Apr 2020 16:11:16 +0800 Subject: [PATCH] p2p/discv5: add missing Timer.Stop calls (#20853) --- p2p/discv5/net.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go index dd2ec3e92..8a548eeb4 100644 --- a/p2p/discv5/net.go +++ b/p2p/discv5/net.go @@ -357,6 +357,8 @@ func (net *Network) loop() { bucketRefreshTimer = time.NewTimer(bucketRefreshInterval) refreshDone chan struct{} // closed when the 'refresh' lookup has ended ) + defer refreshTimer.Stop() + defer bucketRefreshTimer.Stop() // Tracking the next ticket to register. var ( @@ -393,11 +395,13 @@ func (net *Network) loop() { searchInfo = make(map[Topic]topicSearchInfo) activeSearchCount int ) + defer topicRegisterLookupTick.Stop() topicSearchLookupDone := make(chan topicSearchResult, 100) topicSearch := make(chan Topic, 100) <-topicRegisterLookupTick.C statsDump := time.NewTicker(10 * time.Second) + defer statsDump.Stop() loop: for {