Skip to content

Commit 53a64b3

Browse files
fix: do not release connection lock unless you have it
1 parent db2c3d8 commit 53a64b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tcp_modbus_aio/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ async def send_modbus_message(
514514

515515
return None
516516
finally:
517-
self._comms_lock.release()
517+
if self._comms_lock.locked():
518+
self._comms_lock.release()
518519

519520
response_function = create_function_from_response_pdu(
520521
response_pdu, request_function

0 commit comments

Comments
 (0)