diff --git a/quinn-proto/src/lib.rs b/quinn-proto/src/lib.rs index 19ca29335..e200eaf3e 100644 --- a/quinn-proto/src/lib.rs +++ b/quinn-proto/src/lib.rs @@ -89,12 +89,14 @@ pub enum Side { impl Side { #[inline] - fn is_client(self) -> bool { + /// Shorthand for `self == Side::Client` + pub fn is_client(self) -> bool { self == Side::Client } #[inline] - fn is_server(self) -> bool { + /// Shorthand for `self == Side::Server` + pub fn is_server(self) -> bool { self == Side::Server } } diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index dc084ec25..6767d38a2 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -171,7 +171,10 @@ impl Connection { { let mut conn = self.0.lock().unwrap(); if let Some(x) = conn.inner.open(Directionality::Uni) { - let _ = send.send(Ok((x, conn.inner.is_handshaking()))); + let _ = send.send(Ok(( + x, + conn.inner.side().is_client() && conn.inner.is_handshaking(), + ))); } else { conn.uni_opening.push_back(send); // We don't notify the driver here because there's no way to ask the peer for more @@ -194,7 +197,10 @@ impl Connection { { let mut conn = self.0.lock().unwrap(); if let Some(x) = conn.inner.open(Directionality::Bi) { - let _ = send.send(Ok((x, conn.inner.is_handshaking()))); + let _ = send.send(Ok(( + x, + conn.inner.side().is_client() && conn.inner.is_handshaking(), + ))); } else { conn.bi_opening.push_back(send); // We don't notify the driver here because there's no way to ask the peer for more