Handle IncompleteRead in handle_incoming

This commit is contained in:
mhchia 2019-09-13 15:32:10 +08:00
parent 2d8e02b7eb
commit f62f07bb9f
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A

View File

@ -2,6 +2,7 @@ import asyncio
from typing import Any # noqa: F401
from typing import Awaitable, Dict, List, Optional, Tuple
from libp2p.io.exceptions import IncompleteReadError
from libp2p.peer.id import ID
from libp2p.security.secure_conn_interface import ISecureConn
from libp2p.stream_muxer.abc import IMuxedConn, IMuxedStream
@ -184,7 +185,11 @@ class Mplex(IMuxedConn):
channel_id, flag, message = await self._wait_until_shutting_down_or_closed(
self.read_message()
)
except (MplexUnavailable, ConnectionResetError) as error:
except (
MplexUnavailable,
ConnectionResetError,
IncompleteReadError,
) as error:
print(f"!@# handle_incoming: read_message: exception={error}")
break
if channel_id is not None and flag is not None and message is not None: