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

poll: Do not clear readiness on short read/writes. #5881

Merged
merged 2 commits into from
Jul 19, 2023

Conversation

jasta
Copy link
Contributor

@jasta jasta commented Jul 18, 2023

Motivation

The new mio_unsupported_force_poll_poll behaviour works the same as Windows (using level-triggered APIs to mimic edge-triggered ones) and it depends on intercepting an EAGAIN result to start polling the fd again. Without this change, short reads don't reregister with the poll Selector and it causes the socket to stall in a read async call forever.

Solution

Per #5866, going with the simplest solution of just adding another cfg! check alongside the Windows one.

The new mio_unsupported_force_poll_poll behaviour works the same as
Windows (using level-triggered APIs to mimic edge-triggered ones) and it
depends on intercepting an EAGAIN result to start polling the fd again.
Copy link
Contributor

@Noah-Kennedy Noah-Kennedy left a comment

Choose a reason for hiding this comment

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

Add some comments inline so folks don't get confused in the future, then I think we're good.

tokio/src/io/poll_evented.rs Show resolved Hide resolved
@jasta jasta requested a review from Noah-Kennedy July 18, 2023 23:18
Copy link
Contributor

@Noah-Kennedy Noah-Kennedy left a comment

Choose a reason for hiding this comment

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

Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-io Module: tokio/io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants