mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add test for Swarm.close_peer
This commit is contained in:
@ -50,11 +50,12 @@ class SwarmConn(INetConn):
|
||||
task.cancel()
|
||||
|
||||
async def _handle_new_streams(self) -> None:
|
||||
# TODO: Break the loop when anything wrong in the connection.
|
||||
while True:
|
||||
try:
|
||||
stream = await self.conn.accept_stream()
|
||||
except MuxedConnUnavailable:
|
||||
# If there is anything wrong in the MuxedConn,
|
||||
# we should break the loop and close the connection.
|
||||
break
|
||||
# Asynchronously handle the accepted stream, to avoid blocking the next stream.
|
||||
await self.run_task(self._handle_muxed_stream(stream))
|
||||
|
||||
Reference in New Issue
Block a user