diff --git a/Cargo.toml b/Cargo.toml index f0169edff7..4f9c7cfc2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ atomic-waker = { version = "1.1.2", optional = true } futures-channel = { version = "0.3", optional = true } futures-core = { version = "0.3.31", optional = true } futures-util = { version = "0.3", default-features = false, features = ["alloc"], optional = true } -h2 = { version = "0.4.2", optional = true } +h2 = { version = "0.4.6", optional = true } http-body-util = { version = "0.1", optional = true } httparse = { version = "1.9", optional = true } httpdate = { version = "1.0", optional = true } diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index fa6151f160..99cebd6d89 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -216,6 +216,26 @@ where pub fn is_extended_connect_protocol_enabled(&self) -> bool { self.inner.1.is_extended_connect_protocol_enabled() } + + /// Returns the current maximum send stream count. + /// + /// This setting is configured in a [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][1] in a `SETTINGS` frame, + /// and may change throughout the connection lifetime. + /// + /// [1]: https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.2 + pub fn current_max_send_streams(&self) -> usize { + self.inner.1.current_max_send_streams() + } + + /// Returns the current maximum receive stream count. + /// + /// This setting is configured in a [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][1] in a `SETTINGS` frame, + /// and may change throughout the connection lifetime. + /// + /// [1]: https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.2 + pub fn current_max_recv_streams(&self) -> usize { + self.inner.1.current_max_recv_streams() + } } impl fmt::Debug for Connection diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index 1fcc288c88..f96d67d73a 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -442,6 +442,12 @@ where pub(crate) fn is_extended_connect_protocol_enabled(&self) -> bool { self.h2_tx.is_extended_connect_protocol_enabled() } + pub(crate) fn current_max_send_streams(&self) -> usize { + self.h2_tx.current_max_send_streams() + } + pub(crate) fn current_max_recv_streams(&self) -> usize { + self.h2_tx.current_max_recv_streams() + } } pin_project! {