Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions gossipsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ func (gs *GossipSubRouter) rpcs(msg *Message) iter.Seq2[peer.ID, *RPC] {

// gossipsub peers
gmap, ok := gs.mesh[topic]
if !ok {
if !ok || len(gmap) == 0 {
// we are not in the mesh for topic, use fanout peers
gmap, ok = gs.fanout[topic]
if !ok || len(gmap) == 0 {
Comment on lines +1367 to 1370
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also consider adding:
Dlo - len(gmap) peers from fanout.

Expand Down Expand Up @@ -1477,7 +1477,11 @@ func (gs *GossipSubRouter) Join(topic string) {
return !direct && !doBackOff && gs.score.Score(p) >= 0
})
gmap = peerListToMap(peers)
gs.mesh[topic] = gmap
// It is possible that we do not have any peers subscribed to this topic yet so continue fanout
// to ensure that messages we publish in the intermin are not lost
if len(gmap) > 0 {
gs.mesh[topic] = gmap
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this? The len check when we build the list of peers to publish to is enough.

}

for p := range gmap {
Expand Down
Loading