driver: end_session if ConnClose & Dfu is recv-ed

This commit is contained in:
linuswck 2024-09-04 15:28:58 +08:00
parent 0b5fda2cd9
commit 6d4b1b0574
1 changed files with 7 additions and 0 deletions

View File

@ -811,7 +811,14 @@ class Kirdy:
response = await self._read_response()
if response["msg_type"] == 'HardReset':
logging.warn("Kirdy is being hard reset.")
raise asyncio.exceptions.CancelledError
if response["msg_type"] == 'Dfu':
logging.warn("Kirdy enters Dfu Mode.")
asyncio.create_task(self.end_session())
if response["msg_type"] == 'ConnectionClose':
logging.warn("Kirdy runs out of TCP sockets and closes this connected socket.")
asyncio.create_task(self.end_session())
if response["msg_type"] == 'Report' and not self._msg_queue_get_report:
if self._report_sig is None:
self._report_queue.put_nowait_overwrite(response)