diff --git a/libp2p/host/basic_host.py b/libp2p/host/basic_host.py index d12d672..7469d33 100644 --- a/libp2p/host/basic_host.py +++ b/libp2p/host/basic_host.py @@ -168,7 +168,11 @@ class BasicHost(IHost): protocol, handler = await self.multiselect.negotiate( MultiselectCommunicator(net_stream) ) - except MultiselectError: + except MultiselectError as error: + peer_id = net_stream.muxed_conn.peer_id + logger.debug( + "failed to accept a stream from peer %s, error=%s", peer_id, error + ) await net_stream.reset() return net_stream.set_protocol(protocol) diff --git a/libp2p/stream_muxer/mplex/mplex.py b/libp2p/stream_muxer/mplex/mplex.py index c8d7a20..2228360 100644 --- a/libp2p/stream_muxer/mplex/mplex.py +++ b/libp2p/stream_muxer/mplex/mplex.py @@ -1,4 +1,5 @@ import asyncio +import logging from typing import Any # noqa: F401 from typing import Awaitable, Dict, List, Optional, Tuple @@ -23,6 +24,8 @@ from .mplex_stream import MplexStream MPLEX_PROTOCOL_ID = TProtocol("/mplex/6.7.0") +logger = logging.getLogger("libp2p.stream_muxer.mplex.mplex") + class Mplex(IMuxedConn): """ @@ -181,7 +184,8 @@ class Mplex(IMuxedConn): while True: try: await self._handle_incoming_message() - except MplexUnavailable: + except MplexUnavailable as e: + logger.debug("mplex unavailable while waiting for incoming: %s", e) break # Force context switch await asyncio.sleep(0)