Skip to content

Commit 0e55b6e

Browse files
fix: catch OSError on clearing tcp connection
1 parent 3ae24e8 commit 0e55b6e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tcp_modbus_aio/client.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,11 @@ async def clear_tcp_connection(self) -> None:
314314

315315
try:
316316
await self._writer.wait_closed()
317-
except (TimeoutError, ConnectionResetError):
317+
except (TimeoutError, ConnectionResetError, OSError) as e:
318318
if self.logger is not None:
319319
self.logger.warning(
320-
f"[{self}][clear_tcp_connection] connection close timed out, continuing anyway"
320+
f"[{self}][clear_tcp_connection] {type(e).__name__}({e}) error on connection close, "
321+
"continuing anyway"
321322
)
322323

323324
pass

0 commit comments

Comments
 (0)