-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix fill_buf by not calling poll_fill_buf twice #4084
Conversation
Should some kind of regression test be added here? |
I don't think it's particularly necessary here, but I can add one. |
use tokio_test::assert_ok; | ||
|
||
#[tokio::test] | ||
async fn fill_buf_file() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take it or leave it: maybe worth a comment summarizing the bug this is a regression test for (and a link to the original issue?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really feel like waiting for CI over again, since I am making a release immediately after merging this.
There are some IO resources which hit the panic when calling
poll_fill_buf
twice, e.g. aBufReader<File>
will do this when you are at EOF.A safe alternative is to check for empty slices and handle those in a special way, but I prefer this as it is a more robust solution.
Fixes: #4085