From e77cd3e33d0771c515adffd6b8455ec78d4cd4e7 Mon Sep 17 00:00:00 2001 From: James Leitch Date: Fri, 10 Nov 2023 17:30:10 +0000 Subject: [PATCH] Updates docs for `Connection::accept_bi()` and `Connection::open_bi()` --- quinn/src/connection.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index ef6f0dba7..5bed610cb 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -282,7 +282,12 @@ impl Connection { /// /// Streams are cheap and instantaneous to open unless blocked by flow control. As a /// consequence, the peer won't be notified that a stream has been opened until the stream is - /// actually used. + /// actually used. Calling [`open_bi()`] then waiting on the [`RecvStream`] without writing + /// anything to [`SendStream`] will never succeed. + /// + /// [`open_bi()`]: crate::Connection::open_bi + /// [`SendStream`]: crate::SendStream + /// [`RecvStream`]: crate::RecvStream pub fn open_bi(&self) -> OpenBi<'_> { OpenBi { conn: &self.0, @@ -299,6 +304,15 @@ impl Connection { } /// Accept the next incoming bidirectional stream + /// + /// **Important Note**: The `Connection` that calls [`open_bi()`] must write to its [`SendStream`] + /// before the other `Connection` is able to `accept_bi()`. Calling [`open_bi()`] then + /// waiting on the [`RecvStream`] without writing anything to [`SendStream`] will never succeed. + /// + /// [`accept_bi()`]: crate::Connection::accept_bi + /// [`open_bi()`]: crate::Connection::open_bi + /// [`SendStream`]: crate::SendStream + /// [`RecvStream`]: crate::RecvStream pub fn accept_bi(&self) -> AcceptBi<'_> { AcceptBi { conn: &self.0,