Skip to content

Commit

Permalink
fix: catch OSError on clearing tcp connection
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuagruenstein committed Jun 27, 2024
1 parent 3ae24e8 commit 0e55b6e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tcp_modbus_aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,11 @@ async def clear_tcp_connection(self) -> None:

try:
await self._writer.wait_closed()
except (TimeoutError, ConnectionResetError):
except (TimeoutError, ConnectionResetError, OSError) as e:
if self.logger is not None:
self.logger.warning(
f"[{self}][clear_tcp_connection] connection close timed out, continuing anyway"
f"[{self}][clear_tcp_connection] {type(e).__name__}({e}) error on connection close, "
"continuing anyway"
)

pass
Expand Down

0 comments on commit 0e55b6e

Please sign in to comment.