Skip to content

Commit c87cdd3

Browse files
authored
p2p/discv5: add missing Timer.Stop calls (#20853)
1 parent f15849c commit c87cdd3

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)