From 3451cefd5c88c09646b941777cc7573b83fd8109 Mon Sep 17 00:00:00 2001 From: alemidev Date: Wed, 24 Nov 2021 03:23:30 +0100 Subject: [PATCH] handle timeout error --- aiocraft/dispatcher.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aiocraft/dispatcher.py b/aiocraft/dispatcher.py index 0f79248..7933fb1 100644 --- a/aiocraft/dispatcher.py +++ b/aiocraft/dispatcher.py @@ -221,6 +221,9 @@ class Dispatcher: await self._incoming.join() # During play we can pre-process packets except AttributeError: self._logger.debug("Received unimplemented packet [%d] %s", packet_id, cls.__name__) # TODO this is cheating! implement them! + except TimeoutError: + self._logger.error("Connection timed out") + await self.disconnect(block=False) except ConnectionResetError: self._logger.error("Connection reset while reading packet") await self.disconnect(block=False)