Skip to content

Commit e29133e

Browse files
[runtime/network] poison sink/stream on error and cancellation (#3501)
Co-authored-by: Patrick O'Grady <me@patrickogrady.xyz>
1 parent 8554f46 commit e29133e

7 files changed

Lines changed: 699 additions & 143 deletions

File tree

runtime/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ stability_scope!(BETA {
601601
/// # Warning
602602
///
603603
/// If the sink returns an error, part of the message may still be delivered.
604+
/// After any error, the sink is no longer reusable and subsequent sends will
605+
/// return [`Error::Closed`].
606+
///
607+
/// Dropping the future (e.g. via `select!`) also poisons the sink, since a
608+
/// partial write may have occurred.
604609
fn send(
605610
&mut self,
606611
bufs: impl Into<IoBufs> + Send,
@@ -617,6 +622,11 @@ stability_scope!(BETA {
617622
/// # Warning
618623
///
619624
/// If the stream returns an error, partially read data may be discarded.
625+
/// After any error, the stream is no longer reusable and subsequent receives
626+
/// will return [`Error::Closed`].
627+
///
628+
/// Dropping the future (e.g. via `select!`) also poisons the stream, since
629+
/// partially read data may be lost.
620630
fn recv(&mut self, len: usize) -> impl Future<Output = Result<IoBufs, Error>> + Send;
621631

622632
/// Peek at buffered data without consuming.

0 commit comments

Comments
 (0)