@@ -214,6 +214,12 @@ macro_rules! impl_send_stream_api {
214
214
/// the peer.
215
215
/// - `Err(e)` if the stream encountered a [`stream::Error`](crate::stream::Error).
216
216
///
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
+ ///
217
223
/// # Examples
218
224
///
219
225
/// ```rust,no_run
@@ -413,10 +419,12 @@ macro_rules! impl_send_stream_trait {
413
419
414
420
#[ inline]
415
421
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 <' _>,
418
424
) -> 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 ( ( ) ) )
420
428
}
421
429
422
430
#[ inline]
@@ -476,11 +484,12 @@ macro_rules! impl_send_stream_trait {
476
484
477
485
#[ inline]
478
486
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 <' _>,
481
489
) -> 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 ( ( ) ) )
484
493
}
485
494
486
495
#[ inline]
@@ -541,9 +550,11 @@ macro_rules! impl_send_stream_trait {
541
550
#[ inline]
542
551
fn poll_flush(
543
552
self : core:: pin:: Pin <& mut Self >,
544
- cx : & mut core:: task:: Context <' _>,
553
+ _cx : & mut core:: task:: Context <' _>,
545
554
) -> 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 ( ( ) ) )
547
558
}
548
559
549
560
#[ inline]
0 commit comments