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(s2n-quic): make AsyncWrite::poll_flush a no-op #2347

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions quic/s2n-quic/src/stream/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ macro_rules! impl_send_stream_api {
/// the peer.
/// - `Err(e)` if the stream encountered a [`stream::Error`](crate::stream::Error).
///
/// # Note
///
/// Using this function can potentially introduce additional latency, as it will only
/// return after all outstanding data is acknowledged by the peer. For this reason, the
/// `AsyncWrite` trait implementations do not use this functionality and are merely no-ops.
///
/// # Examples
///
/// ```rust,no_run
Expand Down Expand Up @@ -413,10 +419,12 @@ macro_rules! impl_send_stream_trait {

#[inline]
fn poll_flush(
mut self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
self: core::pin::Pin<&mut Self>,
_cx: &mut core::task::Context<'_>,
) -> core::task::Poll<$crate::stream::Result<()>> {
Self::poll_flush(&mut self, cx)
// no-op - this contract relies on flushing intermediate buffers, not waiting for
// the peer to ACK data
core::task::Poll::Ready(Ok(()))
}

#[inline]
Expand Down Expand Up @@ -476,11 +484,12 @@ macro_rules! impl_send_stream_trait {

#[inline]
fn poll_flush(
mut self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
self: core::pin::Pin<&mut Self>,
_cx: &mut core::task::Context<'_>,
) -> core::task::Poll<std::io::Result<()>> {
core::task::ready!($name::poll_flush(&mut self, cx))?;
Ok(()).into()
// no-op - this contract relies on flushing intermediate buffers, not waiting for
// the peer to ACK data
core::task::Poll::Ready(Ok(()))
}

#[inline]
Expand Down Expand Up @@ -541,9 +550,11 @@ macro_rules! impl_send_stream_trait {
#[inline]
fn poll_flush(
self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
_cx: &mut core::task::Context<'_>,
) -> core::task::Poll<std::io::Result<()>> {
futures::io::AsyncWrite::poll_flush(self, cx)
// no-op - this contract relies on flushing intermediate buffers, not waiting for
// the peer to ACK data
core::task::Poll::Ready(Ok(()))
}

#[inline]
Expand Down
Loading