A little bit clean up

This commit is contained in:
mhchia 2019-07-27 12:06:36 +08:00
parent c028aef2de
commit 766d8ba1e1
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A
2 changed files with 6 additions and 11 deletions

View File

@ -208,13 +208,11 @@ class GossipSub(IPubsubRouter):
# in the fanout for a topic (or the topic is not in the fanout). # in the fanout for a topic (or the topic is not in the fanout).
# Selects the remaining number of peers (D-x) from peers.gossipsub[topic]. # Selects the remaining number of peers (D-x) from peers.gossipsub[topic].
if topic in self.pubsub.peer_topics: if topic in self.pubsub.peer_topics:
gossipsub_peers_in_topic = [peer for peer in self.pubsub.peer_topics[topic] selected_peers = self._get_peers_from_minus(
if peer in self.peers_gossipsub] topic,
selected_peers = \ self.degree - fanout_size,
GossipSub.select_from_minus(self.degree - fanout_size, fanout_peers,
gossipsub_peers_in_topic, )
fanout_peers)
# Combine fanout peers with selected peers # Combine fanout peers with selected peers
fanout_peers += selected_peers fanout_peers += selected_peers
@ -295,7 +293,7 @@ class GossipSub(IPubsubRouter):
selected_peers = GossipSub.select_from_minus( selected_peers = GossipSub.select_from_minus(
self.degree - num_mesh_peers_in_topic, self.degree - num_mesh_peers_in_topic,
gossipsub_peers_in_topic, gossipsub_peers_in_topic,
self.mesh[topic] self.mesh[topic],
) )
fanout_peers_not_in_mesh = [ fanout_peers_not_in_mesh = [

View File

@ -313,9 +313,6 @@ class Pubsub:
# Write message to stream # Write message to stream
await stream.write(rpc_msg) await stream.write(rpc_msg)
def list_peers(self, topic_id: str) -> Tuple[ID, ...]:
return
async def publish(self, topic_id: str, data: bytes) -> None: async def publish(self, topic_id: str, data: bytes) -> None:
""" """
Publish data to a topic Publish data to a topic