fastwebsockets icon indicating copy to clipboard operation
fastwebsockets copied to clipboard

Add flush method to ensure frame is correctly written

Open erebe opened this issue 1 year ago • 0 comments

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>). 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 https://github.com/erebe/wstunnel/issues/360

erebe avatar Oct 01 '24 19:10 erebe