From 4617f49b266d560a773372a90be283ba8b2400a9 Mon Sep 17 00:00:00 2001 From: dswij Date: Mon, 10 Jun 2024 20:30:49 +0800 Subject: [PATCH] feat: expose current max {recv,send} stream count (#784) --- 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> {