Skip to content

Commit db11425

Browse files
committed
fix(s2n-quic): make AsyncWrite::poll_flush a no-op
1 parent 2271c26 commit db11425

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

quic/s2n-quic/src/stream/send.rs

+20-9
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ macro_rules! impl_send_stream_api {
214214
/// the peer.
215215
/// - `Err(e)` if the stream encountered a [`stream::Error`](crate::stream::Error).
216216
///
217+
/// # Note
218+
///
219+
/// Using this function can potentially introduce additional latency, as it will only
220+
/// return after all outstanding data is acknowledged by the peer. For this reason, the
221+
/// `AsyncWrite` trait implementations do not use this functionality and are merely no-ops.
222+
///
217223
/// # Examples
218224
///
219225
/// ```rust,no_run
@@ -413,10 +419,12 @@ macro_rules! impl_send_stream_trait {
413419

414420
#[inline]
415421
fn poll_flush(
416-
mut self: core::pin::Pin<&mut Self>,
417-
cx: &mut core::task::Context<'_>,
422+
self: core::pin::Pin<&mut Self>,
423+
_cx: &mut core::task::Context<'_>,
418424
) -> core::task::Poll<$crate::stream::Result<()>> {
419-
Self::poll_flush(&mut self, cx)
425+
// no-op - this contract relies on flushing intermediate buffers, not waiting for
426+
// the peer to ACK data
427+
core::task::Poll::Ready(Ok(()))
420428
}
421429

422430
#[inline]
@@ -476,11 +484,12 @@ macro_rules! impl_send_stream_trait {
476484

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

486495
#[inline]
@@ -541,9 +550,11 @@ macro_rules! impl_send_stream_trait {
541550
#[inline]
542551
fn poll_flush(
543552
self: core::pin::Pin<&mut Self>,
544-
cx: &mut core::task::Context<'_>,
553+
_cx: &mut core::task::Context<'_>,
545554
) -> core::task::Poll<std::io::Result<()>> {
546-
futures::io::AsyncWrite::poll_flush(self, cx)
555+
// no-op - this contract relies on flushing intermediate buffers, not waiting for
556+
// the peer to ACK data
557+
core::task::Poll::Ready(Ok(()))
547558
}
548559

549560
#[inline]

0 commit comments

Comments
 (0)