Fix for socket.send() exceptions in the logs

This commit is contained in:
rospogrigio
2023-06-07 11:59:31 +02:00
parent 53e1ad8488
commit 9d5984e4cf
2 changed files with 4 additions and 5 deletions

View File

@@ -766,10 +766,9 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
enc_payload = self._encode_message(payload)
self.transport.write(enc_payload)
try:
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
except Exception as ex:
self.debug("Wait was aborted for seqno %d (%s)", seqno, ex)
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
if msg is None:
self.debug("Wait was aborted for seqno %d", seqno)
return None
# TODO: Verify stuff, e.g. CRC sequence number?