Skip to content
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

bug: correct read behavior #16

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Conversation

a-w50
Copy link
Contributor

@a-w50 a-w50 commented May 30, 2024

The ReadResult read(uint8_t* buf, size_t len) function should always set the would_block property of the ReadResult to true, if it reads less bytes then requested. Otherwise, the caller might assume that the requested bytes have been read.
The implementation of the ConnectionPlain class didn't respect this contract and hence yielded a bug, as the caller assumed the bytes were completely read.

Describe your changes

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

The `ReadResult read(uint8_t* buf, size_t len)` function should always
set the `would_block` property of the `ReadResult` to true, if it reads
less bytes then requested.  Otherwise, the caller might assume that the
requested bytes have been read.
The implementation of the ConnectionPlain class didn't respect this
contract and hence yielded a bug, as the caller assumed the bytes were
completely read.

Signed-off-by: aw <aw@pionix.de>
@a-w50 a-w50 requested review from SebaLukas and MarzellT as code owners May 30, 2024 11:01
Copy link
Collaborator

@SebaLukas SebaLukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SebaLukas SebaLukas merged commit 9283391 into main Jun 3, 2024
4 checks passed
@SebaLukas SebaLukas deleted the bugfix/correct_read_behavior branch June 3, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants