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

Implemented ReadAtLeastAsync #51979

Merged
merged 6 commits into from
May 1, 2021
Merged

Implemented ReadAtLeastAsync #51979

merged 6 commits into from
May 1, 2021

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Apr 28, 2021

  • Implemented the PipeReader implementation and override the method on Pipe.
  • The Pipe implementation has some caveats. Calling ReadAtLeast messes with the pipe back pressure since it's trying to prevent deadlocks. This means that if ReadAsync is called with a big threshold, the writer will write as fast as it can ignoring the PauseThreshold up until the reader is unblocked. In a sense, the call to ReadAtLeast async overrides the pause threshold for that one read.
  • Added tests
  • Added missing StreamConformance tests to the solution so it would build

Fixes #25063

PS: I need some more default implementation tests. Done

- Implemented the PipeReader implementation and override the method on Pipe.
- The Pipe implementation has some caveats. Calling ReadAtLeast messes with the pipe back pressure since it's trying to prevent deadlocks. This means that if ReadAsync is called with a big threshold, the writer will write as fast as it can ignoring the PauseThreshold up until the reader is unblocked. In a sense, the call to ReadAtLeast async overrides the pause threshold for that one read.
- Added tests
- Added missing StreamConformance tests to the solution so it would build
@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

- Flip the reading state off when we decide not to accept the read
@davidfowl
Copy link
Member Author

Looked at the failures and they are unrelated.

@davidfowl
Copy link
Member Author

@davidfowl davidfowl merged commit a46f7e9 into main May 1, 2021
@jkotas jkotas deleted the davidfowl/minimum-read-length branch May 3, 2021 14:59
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API Proposal: Add PipeReader.ReadAsync overloads to allow waiting for a specific amount of data
6 participants