Skip to content

Commit

Permalink
added missing Close call on the AddrBook member of GossipSubRouter (#568
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sstanculeanu authored Jul 11, 2024
1 parent 093f13c commit e508d86
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gossipsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pubsub
import (
"context"
"fmt"
"io"
"math/rand"
"sort"
"time"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e508d86

Please sign in to comment.