Skip to content

Commit 52be237

Browse files
committed
review changes
1 parent c2a208f commit 52be237

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hathor/p2p/manager.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,14 @@ def on_peer_ready(self, protocol: HathorProtocol) -> None:
379379
protocol.enable_sync()
380380

381381
# Notify other peers about this new peer connection.
382+
self.relay_peer_to_ready_connections(protocol.my_peer)
383+
384+
def relay_peer_to_ready_connections(self, peer: PeerId):
385+
"""Relay peer to all ready connections."""
382386
for conn in self.iter_ready_connections():
383-
if conn != protocol:
384-
assert conn.state is not None
387+
if conn.peer != peer:
385388
assert isinstance(conn.state, ReadyState)
386-
conn.state.send_peers([protocol.my_peer])
389+
conn.state.send_peers([peer])
387390

388391
def on_peer_disconnect(self, protocol: HathorProtocol) -> None:
389392
"""Called when a peer disconnect."""

0 commit comments

Comments
 (0)