Skip to content

Commit 870be43

Browse files
committed
Log debug on no response to unbounded read
It's not just not receiving the right number of bytes when there is a known number of bytes to read that is an issue, but also when there is no response at all to a read of None bytes (_recv isn't invoked unless one expects a response).
1 parent 7973995 commit 870be43

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pymodbus/transaction.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ def _recv(self, expected_response_length, full):
317317
_logger.debug("{} received, "
318318
"Expected {} bytes Recieved "
319319
"{} bytes !!!!".format(msg_start, total, actual))
320+
elif actual == 0:
321+
# If actual == 0 and total is not None then the above
322+
# should be triggered, so total must be None here
323+
_logger.debug("No response received to unbounded read !!!!")
320324
if self.client.state != ModbusTransactionState.PROCESSING_REPLY:
321325
_logger.debug("Changing transaction state from "
322326
"'WAITING FOR REPLY' to 'PROCESSING REPLY'")

0 commit comments

Comments
 (0)