From b2c5371323ddf12e712ad48cdaa84df6f176f7f2 Mon Sep 17 00:00:00 2001 From: mhchia Date: Thu, 29 Aug 2019 22:00:07 +0800 Subject: [PATCH] Add TODO for `Swarm.connections` --- libp2p/network/swarm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/network/swarm.py b/libp2p/network/swarm.py index d0f2fe8..a8d1003 100644 --- a/libp2p/network/swarm.py +++ b/libp2p/network/swarm.py @@ -32,6 +32,8 @@ class Swarm(INetwork): upgrader: TransportUpgrader transport: ITransport router: IPeerRouting + # TODO: Connections an `peer_id` are 1-1 mapping in our implementation, + # whereas in Go one `peer_id` may point to multiple connections. connections: Dict[ID, IMuxedConn] listeners: Dict[str, IListener] stream_handlers: Dict[INetStream, Callable[[INetStream], None]] @@ -225,10 +227,8 @@ class Swarm(INetwork): raise SwarmException( f"fail to upgrade the connection to a muxed connection from {peer_id}" ) from error - # Store muxed_conn with peer id self.connections[peer_id] = muxed_conn - # Call notifiers since event occurred for notifee in self.notifees: await notifee.connected(self, muxed_conn)