added missing Close call on the AddrBook member of GossipSubRouter (#568)

This commit is contained in:
Sorin Stanculeanu 2024-07-11 18:25:52 +03:00 committed by GitHub
parent 093f13ce16
commit e508d8643d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {