Repository navigation
Read packet bytes incrementally from blocking streams - #166
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation preserves truncation handling and has regression coverage for partial reads and packet delivery before EOF.
No open issues 🎉
What changed in this PR
Updates iter_packet_bytes() to decode packets incrementally from blocking binary streams, addressing #92 without waiting for EOF.
Changes:
- Combines partial reads and yields each complete packet while leaving caller-owned streams open.
- Adds tests for short reads, delivery over an open socket, and truncated input.
- Documents stream requirements and provides a TCP socket example.
| File | Description |
|---|---|
docs/user-guide/utils.rst |
Documents blocking streams, packet alignment, and socket usage. |
ccsdspy/utils.py |
Replaces whole-input loading with incremental header and payload reads. |
ccsdspy/tests/test_utils.py |
Adds streaming and truncation regression coverage. |
Review effort: Balanced
Collaborator
|
Thanks @giovannicozzolongo ! I'll make a release shortly with this and a couple bug fixes. |
Collaborator
|
@giovannicozzolongo a release has been made and pushed to PyPI |
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.
Closes #92.
iter_packet_bytes()now reads packets from blocking streams without waiting for EOF. Packet alignment is left to the caller, as discussed in the issue. Added tests for partial reads and delivery while the socket is still open. The test suite passes with Python 3.12.