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

Add flush method to ensure frame is correctly written #88

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

erebe
Copy link
Contributor

@erebe erebe commented Oct 1, 2024

When the underlying stream is buffered (i.e: TlsStream) calling write_frame is not enough to be guaranteed that data is pushed down to the last stream (i.e: on the network in case of TlsStream).
https://docs.rs/tokio-rustls/latest/tokio_rustls/index.html#why-do-i-need-to-call-poll_flush

Currently there is no way to force flush the data on the stream, so write_frame call may never push the data.
So one can call write_frame and wait for a response that will never come as the other peer never received it.

The PR introduce a flush method, to allow the user of the lib to ensure all data is correctly pushed down.

see this issue for more information erebe/wstunnel#360

When the underlying stream is buffered (i.e: TlsStream<TcpStream>)
calling write_frame is not enough to be guaranteed that data is pushed
down to the last stream (i.e: on the network in case of
TlsStream<TcpStream>).

Currently there is no way to force flush the data on the stream, so
write_frame call may never push the data.
https://docs.rs/tokio-rustls/latest/tokio_rustls/index.html#why-do-i-need-to-call-poll_flush

The commit introduce a flush method, to allow the user of the lib to
ensure all data is correctly pushed down.
Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@littledivy littledivy merged commit 4f274f4 into denoland:main Jan 4, 2025
3 checks passed
MokerWill pushed a commit to MokerWill/fastwebsockets that referenced this pull request Jan 5, 2025
When the underlying stream is buffered (i.e: TlsStream<TcpStream>)
calling write_frame is not enough to be guaranteed that data is pushed
down to the last stream (i.e: on the network in case of
TlsStream<TcpStream>).

Currently there is no way to force flush the data on the stream, so
write_frame call may never push the data.
https://docs.rs/tokio-rustls/latest/tokio_rustls/index.html#why-do-i-need-to-call-poll_flush

The commit introduce a flush method, to allow the user of the lib to
ensure all data is correctly pushed down.

(cherry picked from commit 4f274f4)
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.

2 participants