Fix for socket.send() exceptions in the logs

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

No files matched your search

@@ -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?