-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Max retries #186
Max retries #186
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! Just some minor comments/questions.
Please rebase on main, I have just fixed the unrelated pre-commit issue.
While you are at it: Please add an entry to the changelog. I guess it is time to finally release this new version. |
…hem down to the caller.
…ence with Modbus TCP. No logic changes
I've addressed all your comments. |
As suggested in #184, I've fixed the infinite loop when reading from a broken Modbus RTU bus by introducing a maximum number of retries. When that number is reached, the code gives up and returns an error to the caller.
MAX_RETRIES
is a constant that is set to 20 for now. Feel free to change that or make it configurable.I had to edit other parts of the RTU code, which assumed that decoding can never fail. I took the opportunity to make them more readable and more consistent with the TCP code. Should get obvious when you check this PR commit by commit.
Let me know if this can go through or if there's anything I have to change.
Fixes #184