-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 copy buffered write #4001
Fix copy buffered write #4001
Conversation
4d986f3
to
31f1945
Compare
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.
This implementation doesn't attempt to read while flushing, but maybe that should be part of #3694.
Yes, there are two undecided decisions here.
I think it is good to have |
I would generally expect an IO resource to behave in a reasonable way if we stop flushing and starting writing again. |
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.
This seems good to me.
cherry-pick of tokio-rs/tokio#4001
Motivation
The current copy works poorly in some cases.
when reader output depends on writer and writer is buffered, a deadlock may occur.
see tokio-rs/tls#66
Solution
we can call flush when the reader is not progressing to prevent such deadlocks.