Repository navigation
Validate RFC 2217 settings before sending any of them - #161
Open
Happyfield7 wants to merge 1 commit into
Open
Happyfield7 wants to merge 1 commit into
Happyfield7 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #161 +/- ##
==========================================
+ Coverage 94.38% 94.39% +0.01%
==========================================
Files 25 25
Lines 4437 4446 +9
==========================================
+ Hits 4188 4197 +9
Misses 249 249 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The RFC 2217 backend builds the configuration commands lazily and sends each one before the next field is checked.
reconfigure_port(baudrate=19200, byte_size=9)therefore gets SET-BAUDRATE acknowledged by the server and only then raisesUnsupportedSettingfor the byte size: the call fails, but the port already runs at 19200. Checked against ser2net 4.6 over a pty, sync and async.Change
RFC2217Serial._build_port_config_commands()builds the full command tuple before anything is sent, so a rejected setting fails before the first command goes out. The order of the commands is unchanged, and the sync and async paths both use it.Testing
A small RFC 2217 server in the tests records the commands it receives; sync and async tests check that a rejected byte size sends nothing. Both fail without the change. Full suite passes on macOS and Debian sid, and the ser2net reproduction keeps the line at 9600 with the change.