fix very minor bug in gossipsub

This commit is contained in:
vyzo 2019-08-13 12:01:55 +03:00
parent 9f04364996
commit 2bac4705dc

View File

@ -268,6 +268,17 @@ func (gs *GossipSubRouter) Join(topic string) {
gmap, ok = gs.fanout[topic]
if ok {
if len(gmap) < GossipSubD {
// we need more peers; eager, as this would get fixed in the next heartbeat
more := gs.getPeers(topic, GossipSubD-len(gmap), func(p peer.ID) bool {
// filter our current peers
_, ok := gmap[p]
return !ok
})
for _, p := range more {
gmap[p] = struct{}{}
}
}
gs.mesh[topic] = gmap
delete(gs.fanout, topic)
delete(gs.lastpub, topic)