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

enhancement(async): Make RecordReaders read fn cancel-safe #143

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

MathiasKoch
Copy link
Contributor

@MathiasKoch MathiasKoch commented Jun 6, 2024

The only downside is that the ensure_contiguous function now needs to move the header as well, so there might be a 5 byte overhead in the required TLS RX buffer size.

Fixes #142

Copy link
Member

@lulf lulf left a comment

Choose a reason for hiding this comment

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

Nice work debugging and fixing this. It looks good to me. Do you have time to take a quick look at this as well @bugadani in case I've missed something?

@bugadani
Copy link
Collaborator

bugadani commented Jun 6, 2024

I can't say I understand this, but as long as the tests pass I'm fine with the changes.

@lulf lulf merged commit 9de49c2 into drogue-iot:main Jun 6, 2024
1 check passed
@MathiasKoch
Copy link
Contributor Author

The short version of what it does is, that prior to this the read pointer in self.decoded was incremented when reading the record header initially, after which we had an await point to read additional data, whereas now we make sure to read all data before incrementing the read pointer.

This mean that if the future is dropped in between the two calls to advance, we will simply just attempt the full record again next time.

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.

Application data sometimes not correctly consumed, causing bogus record header
3 participants