Prevent re-adding peers to mesh
This commit is contained in:
parent
42093e40ec
commit
99252e49f8
|
@ -204,6 +204,7 @@ class GossipSub(IPubsubRouter):
|
|||
|
||||
# Add fanout peers to mesh and notifies them with a GRAFT(topic) control message.
|
||||
for peer in fanout_peers:
|
||||
if peer not in self.mesh[topic]:
|
||||
self.mesh[topic].append(peer)
|
||||
await self.emit_graft(topic, peer)
|
||||
|
||||
|
@ -281,7 +282,12 @@ class GossipSub(IPubsubRouter):
|
|||
self.mesh[topic]
|
||||
)
|
||||
|
||||
for peer in selected_peers:
|
||||
fanout_peers_not_in_mesh = [
|
||||
peer
|
||||
for peer in selected_peers
|
||||
if peer not in self.mesh[topic]
|
||||
]
|
||||
for peer in fanout_peers_not_in_mesh:
|
||||
# Add peer to mesh[topic]
|
||||
self.mesh[topic].append(peer)
|
||||
|
||||
|
@ -460,6 +466,7 @@ class GossipSub(IPubsubRouter):
|
|||
|
||||
# Add peer to mesh for topic
|
||||
if topic in self.mesh:
|
||||
if from_id_str not in self.mesh[topic]:
|
||||
self.mesh[topic].append(from_id_str)
|
||||
else:
|
||||
# Respond with PRUNE if not subscribed to the topic
|
||||
|
|
Loading…
Reference in New Issue
Block a user