Repository navigation
fix(server): handle multi-item WRITE_VAR requests - #959
Merged
Merged
Conversation
The server parsed only the first address spec and data item of a WRITE_VAR request and always answered with one success code, so a PUT with several areas silently dropped every item after the first. Parse all address specs, split the data section per item, write each one, and return a return code per item. Fixes #958
Merged
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.
Fixes #958.
The pure-Python server parsed only the first address spec and data item of a WRITE_VAR request, and always answered with one success code. A
PUTwith several areas silently dropped every item after the first.Changes
_parse_request_parametersparses all address specs for multi-item writes, like it already does for reads._parse_requestkeeps the raw data section so it can be split per item (honouring fill bytes after odd-length items)._handle_multi_write_areawrites each item and returns the real item count with one return code per item:0xFFsuccess,0x0Aarea not registered,0x05out of range,0x07truncated data. A failing item is not written and does not block the others.Tests
test_multi_item_write_writes_every_item: the reproduction from the issue (4 DBs, odd and even lengths).test_multi_item_write_reports_per_item_errors: unregistered DB, out-of-range item, and a valid item in one request.Both fail on
masterand pass here. Full suite, mypy and pre-commit pass.