Skip to content

Commit a2e27f0

Browse files
gzliudanucwong
andauthored
fix(p2p/discv5): add missing Timer.Stop calls ethereum#20853 (#2409)
Co-authored-by: ucwong <ucwong@126.com>
1 parent 41eb312 commit a2e27f0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

p2p/discv5/net.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ func (net *Network) loop() {
357357
bucketRefreshTimer = time.NewTimer(bucketRefreshInterval)
358358
refreshDone chan struct{} // closed when the 'refresh' lookup has ended
359359
)
360+
defer refreshTimer.Stop()
361+
defer bucketRefreshTimer.Stop()
360362

361363
// Tracking the next ticket to register.
362364
var (
@@ -393,11 +395,13 @@ func (net *Network) loop() {
393395
searchInfo = make(map[Topic]topicSearchInfo)
394396
activeSearchCount int
395397
)
398+
defer topicRegisterLookupTick.Stop()
396399
topicSearchLookupDone := make(chan topicSearchResult, 100)
397400
topicSearch := make(chan Topic, 100)
398401
<-topicRegisterLookupTick.C
399402

400403
statsDump := time.NewTicker(10 * time.Second)
404+
defer statsDump.Stop()
401405

402406
loop:
403407
for {

0 commit comments

Comments
 (0)