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

Fix error handling in NamedPipe::write #1461

Merged
merged 1 commit into from
Feb 22, 2021

Conversation

blackbeam
Copy link

Hi. This is a part of tokio-rs/tokio#3388.

I found an issue with NamedPipe::write, namely it hangs in WouldBlock if other side is disconnected. The problem is in error handling:

  1. Errors are stashed into the state (here and here);
  2. And then ignored with WouldBlock without changing the state (here).

Another improvement introduced in this PR is better handling of immediately finished operations. For immediately failed operations this means, that the caller won't falsely receive Ok(usize). For immediately succeeded operations this means, that the caller could track the progress with better precision.

Copy link
Member

@carllerche carllerche left a comment

Choose a reason for hiding this comment

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

At a skim, the behavior change looks correct to me. I will let @Thomasdezeeuw comment on any style feedback.

@Thomasdezeeuw
Copy link
Collaborator

The couple of unreachable! statement aren't great, but I don't see a better alternative. I'll merge this as it fixes a bug.

@Thomasdezeeuw Thomasdezeeuw merged commit 58e589f into tokio-rs:master Feb 22, 2021
@Thomasdezeeuw Thomasdezeeuw mentioned this pull request Feb 22, 2021
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.

None yet

3 participants