emitGossip: gossip to D peers.

This commit is contained in:
Raúl Kripalani 2019-10-06 18:52:11 +09:00
parent cd94989155
commit 9103afa349
1 changed files with 8 additions and 6 deletions

View File

@ -527,14 +527,16 @@ func (gs *GossipSubRouter) emitGossip(topic string, exclude map[peer.ID]struct{}
return return
} }
gpeers := gs.getPeers(topic, GossipSubD, func(peer.ID) bool { return true }) // Send gossip to D peers, skipping over the exclude set.
for _, p := range gpeers { gpeers := gs.getPeers(topic, GossipSubD, func(p peer.ID) bool {
// skip mesh peers
_, ok := exclude[p] _, ok := exclude[p]
if !ok { return !ok
})
// Emit the IHAVE gossip to the selected peers.
for _, p := range gpeers {
gs.pushGossip(p, &pb.ControlIHave{TopicID: &topic, MessageIDs: mids}) gs.pushGossip(p, &pb.ControlIHave{TopicID: &topic, MessageIDs: mids})
} }
}
} }
func (gs *GossipSubRouter) flush() { func (gs *GossipSubRouter) flush() {