From 17d00180422ddfaf3e966b406187bd26a54023dd Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Thu, 11 Jul 2024 16:27:48 +0300 Subject: [PATCH] added missing Close call on the AddrBook member of GossipSubRouter --- gossipsub.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gossipsub.go b/gossipsub.go index a36049f7..3121a210 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -3,6 +3,7 @@ package pubsub import ( "context" "fmt" + "io" "math/rand" "sort" "time" @@ -543,6 +544,13 @@ func (gs *GossipSubRouter) manageAddrBook() { for { select { case <-gs.p.ctx.Done(): + cabCloser, ok := gs.cab.(io.Closer) + if ok { + errClose := cabCloser.Close() + if errClose != nil { + log.Warnf("failed to close addr book: %v", errClose) + } + } return case ev := <-sub.Out(): switch ev := ev.(type) {