From d483982acb46befdbec901d7de7f9bab76ab0004 Mon Sep 17 00:00:00 2001 From: mhchia Date: Tue, 4 Feb 2020 15:10:49 +0800 Subject: [PATCH] SwarmConn: don't catch exceptions in handler --- libp2p/network/connection/swarm_connection.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libp2p/network/connection/swarm_connection.py b/libp2p/network/connection/swarm_connection.py index b84db8e..a5e22e7 100644 --- a/libp2p/network/connection/swarm_connection.py +++ b/libp2p/network/connection/swarm_connection.py @@ -20,7 +20,6 @@ class SwarmConn(INetConn): muxed_conn: IMuxedConn swarm: "Swarm" streams: Set[NetStream] - event_started: trio.Event event_closed: trio.Event def __init__(self, muxed_conn: IMuxedConn, swarm: "Swarm") -> None: @@ -72,10 +71,7 @@ class SwarmConn(INetConn): if self.swarm.common_stream_handler is not None: try: await self.swarm.common_stream_handler(net_stream) - # TODO: More exact exceptions - except Exception: - # TODO: Emit logs. - # TODO: Clean up and remove the stream from SwarmConn if there is anything wrong. + finally: self.remove_stream(net_stream) def _add_stream(self, muxed_stream: IMuxedStream) -> NetStream: