Skip to content

Commit

Permalink
poll: Do not clear readiness on short read/writes.
Browse files Browse the repository at this point in the history
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.

Closes #5866
  • Loading branch information
jasta committed Jul 18, 2023
1 parent 91ad76c commit 835121d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tokio/src/io/poll_evented.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ feature! {
Ok(n) => {
// if we read a partially full buffer, this is sufficient on unix to show
// that the socket buffer has been drained
if n > 0 && (!cfg!(windows) && n < len) {
if n > 0 && (!cfg!(windows) && !cfg!(mio_unsupported_force_poll_poll) && n < len) {
self.registration.clear_readiness(evt);
}

Expand Down Expand Up @@ -197,7 +197,7 @@ feature! {
Ok(n) => {
// if we write only part of our buffer, this is sufficient on unix to show
// that the socket buffer is full
if n > 0 && (!cfg!(windows) && n < buf.len()) {
if n > 0 && (!cfg!(windows) && !cfg!(mio_unsupported_force_poll_poll) && n < buf.len()) {
self.registration.clear_readiness(evt);
}

Expand Down

0 comments on commit 835121d

Please sign in to comment.