From 66bcf8d152424faf582a42e1a754e06bfdb22693 Mon Sep 17 00:00:00 2001 From: luka Date: Thu, 20 Feb 2025 16:14:51 +0800 Subject: [PATCH] feat: expose 'streams check' for `Connection` --- src/proto/connection.rs | 5 +++++ src/server.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/proto/connection.rs b/src/proto/connection.rs index 5589fabcb..f7fc8fcb5 100644 --- a/src/proto/connection.rs +++ b/src/proto/connection.rs @@ -242,6 +242,11 @@ where } } + /// Checks if there are any streams + pub fn has_streams(&self) -> bool { + self.inner.streams.has_streams() + } + /// Checks if there are any streams or references left pub fn has_streams_or_other_references(&self) -> bool { // If we poll() and realize that there are no streams or references diff --git a/src/server.rs b/src/server.rs index b00bc0866..144da0ffa 100644 --- a/src/server.rs +++ b/src/server.rs @@ -553,6 +553,11 @@ where self.connection.take_user_pings().map(PingPong::new) } + /// Checks if there are any streams + pub fn has_streams(&self) -> bool { + self.connection.has_streams() + } + /// Returns the maximum number of concurrent streams that may be initiated /// by the server on this connection. ///