exclude non gossip from fanout

This commit is contained in:
Giovanni Petrantoni 2020-06-28 10:55:44 +09:00
parent 8e2c9301a0
commit b7382eaf25
2 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ proc replenishFanout(g: GossipSub, topic: string) =
if g.fanout[topic].len < GossipSubDLo:
debug "replenishing fanout", peers = g.fanout[topic].len
for id, peer in g.peers:
if peer.topics.find(topic) != -1: # linear search but likely faster then a small hash
if peer.proto == GossipSubCodec and peer.topics.find(topic) != -1: # linear search but likely faster then a small hash
if not g.fanout[topic].containsOrIncl(id):
g.lastFanoutPubSub[topic] = Moment.fromNow(GossipSubFanoutTTL)
if g.fanout.getOrDefault(topic).len == GossipSubD:

View File

@ -32,7 +32,7 @@ type
onSend*: proc(peer: PubSubPeer; msgs: var RPCMsg) {.gcsafe, raises: [Defect].}
PubSubPeer* = ref object of RootObj
proto: string # the protocol that this peer joined from
proto*: string # the protocol that this peer joined from
sendConn: Connection
peerInfo*: PeerInfo
handler*: RPCHandler