Conversation
Read sequence bytes, packet data, and checksum in a single getc() call instead of multiple separate calls. This reduces timing issues when communicating with embedded systems over fast serial lines without hardware flow control, where multiple reads with separate timeouts can stack up and cause buffer overruns. Also fix the inner header loop to break and NAK on bad headers rather than sleeping for the full timeout duration, which caused problems with embedded systems. Add comprehensive unit tests for recv() covering: - Successful single-block and multi-block transfers - Bad sequence numbers and bad sequence complements - Corrupted CRC checksums - Short (badly sized) blocks - Timeout during block data read - Checksum mode (crc_mode=0) - Cancellation via 2xCAN during data phase - Retry limit exhaustion on repeated errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Single CAN aborts transfer but spec requires 2x CAN - Short batched read could crash _verify_recv_checksum with IndexError
Collaborator
Author
|
Because the retry_limit changes behavior a bit of a change, that somebody might have previously depended on "unlimited retries" I will bump to version 0.5.0 |
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.
Supersedes #32 by @dcliftreaves
getc()calls with a singlerecv()call, reducing timing and failed packets when using fast serial lines without flow control.