mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 23:20:55 +00:00
Fix exception handling
This commit is contained in:
committed by
Paul Robinson
parent
745458cdff
commit
e56974078a
@ -63,13 +63,13 @@ class TCPListener(IListener):
|
|||||||
await trio.serve_tcp(handler, port, host=host, task_status=task_status)
|
await trio.serve_tcp(handler, port, host=host, task_status=task_status)
|
||||||
|
|
||||||
async def handler(stream: trio.SocketStream) -> None:
|
async def handler(stream: trio.SocketStream) -> None:
|
||||||
remote_host : str = ""
|
remote_host: str = ""
|
||||||
remote_port : int = 0
|
remote_port: int = 0
|
||||||
try:
|
try:
|
||||||
tcp_stream = TrioTCPStream(stream)
|
tcp_stream = TrioTCPStream(stream)
|
||||||
remote_host,remote_port = tcp_stream.get_remote_address()
|
remote_host, remote_port = tcp_stream.get_remote_address()
|
||||||
await self.handler(tcp_stream)
|
await self.handler(tcp_stream)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.debug(f"Connection from {remote_host}:{remote_port} failed.")
|
logger.debug(f"Connection from {remote_host}:{remote_port} failed.")
|
||||||
|
|
||||||
listeners = await nursery.start(
|
listeners = await nursery.start(
|
||||||
|
|||||||
Reference in New Issue
Block a user