Closed stevemk14ebr closed 7 years ago
A link to concerned function would be easier to follow (and provides version and file).
The while
contains the code to handle the timeout values:
https://github.com/stephane/libmodbus/blob/master/src/modbus.c#L463
Timeout should be reset after select
http://man7.org/linux/man-pages/man2/select.2.html
In _modbus_receive_msg
This loops without ever reseting p_tv, which will decrease to a smaller and smaller number the more iterations it takes, causing unexpected timeouts. To fix simply reset p_tv to its initial value after select. I am not sure if this was desired behavior, since its possible you wanted the entire function to timeout after some time, which this would do (i think), or if you wanted select to timeout after some time (which this fails in that case)