From bb13c10bc8f4adfc378ff97b8e10e23ad57d4e62 Mon Sep 17 00:00:00 2001 From: dswij Date: Sat, 8 Jun 2024 17:03:48 +0800 Subject: [PATCH] feat: expose current max {recv,send} stream count --- src/client.rs | 10 ++++++++++ src/proto/streams/streams.rs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/client.rs b/src/client.rs index 6d2b9690..86fef1ec 100644 --- a/src/client.rs +++ b/src/client.rs @@ -548,6 +548,16 @@ where pub fn is_extended_connect_protocol_enabled(&self) -> bool { self.inner.is_extended_connect_protocol_enabled() } + + /// Returns the current max send streams + pub fn current_max_send_streams(&self) -> usize { + self.inner.current_max_send_streams() + } + + /// Returns the current max recv streams + pub fn current_max_recv_streams(&self) -> usize { + self.inner.current_max_recv_streams() + } } impl fmt::Debug for SendRequest diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs index fa8e6843..e6c9ed8a 100644 --- a/src/proto/streams/streams.rs +++ b/src/proto/streams/streams.rs @@ -320,6 +320,16 @@ where .send .is_extended_connect_protocol_enabled() } + + pub fn current_max_send_streams(&self) -> usize { + let me = self.inner.lock().unwrap(); + me.counts.max_send_streams() + } + + pub fn current_max_recv_streams(&self) -> usize { + let me = self.inner.lock().unwrap(); + me.counts.max_recv_streams() + } } impl DynStreams<'_, B> {