Skip to content

Commit e508d86

Browse files
authored
added missing Close call on the AddrBook member of GossipSubRouter (#568)
1 parent 093f13c commit e508d86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gossipsub.go

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package pubsub
33
import (
44
"context"
55
"fmt"
6+
"io"
67
"math/rand"
78
"sort"
89
"time"
@@ -543,6 +544,13 @@ func (gs *GossipSubRouter) manageAddrBook() {
543544
for {
544545
select {
545546
case <-gs.p.ctx.Done():
547+
cabCloser, ok := gs.cab.(io.Closer)
548+
if ok {
549+
errClose := cabCloser.Close()
550+
if errClose != nil {
551+
log.Warnf("failed to close addr book: %v", errClose)
552+
}
553+
}
546554
return
547555
case ev := <-sub.Out():
548556
switch ev := ev.(type) {

0 commit comments

Comments
 (0)