Skip to content

Commit d51cb71

Browse files
authored
feat(client): expose HTTP/2 current max stream count (#4026)
Propogate hyperium/h2#784 up to hyper interface Ref #3623
1 parent 28e73cc commit d51cb71

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ atomic-waker = { version = "1.1.2", optional = true }
3131
futures-channel = { version = "0.3", optional = true }
3232
futures-core = { version = "0.3.31", optional = true }
3333
futures-util = { version = "0.3", default-features = false, features = ["alloc"], optional = true }
34-
h2 = { version = "0.4.2", optional = true }
34+
h2 = { version = "0.4.6", optional = true }
3535
http-body-util = { version = "0.1", optional = true }
3636
httparse = { version = "1.9", optional = true }
3737
httpdate = { version = "1.0", optional = true }

src/client/conn/http2.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,26 @@ where
216216
pub fn is_extended_connect_protocol_enabled(&self) -> bool {
217217
self.inner.1.is_extended_connect_protocol_enabled()
218218
}
219+
220+
/// Returns the current maximum send stream count.
221+
///
222+
/// This setting is configured in a [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][1] in a `SETTINGS` frame,
223+
/// and may change throughout the connection lifetime.
224+
///
225+
/// [1]: https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.2
226+
pub fn current_max_send_streams(&self) -> usize {
227+
self.inner.1.current_max_send_streams()
228+
}
229+
230+
/// Returns the current maximum receive stream count.
231+
///
232+
/// This setting is configured in a [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][1] in a `SETTINGS` frame,
233+
/// and may change throughout the connection lifetime.
234+
///
235+
/// [1]: https://datatracker.ietf.org/doc/html/rfc7540#section-5.1.2
236+
pub fn current_max_recv_streams(&self) -> usize {
237+
self.inner.1.current_max_recv_streams()
238+
}
219239
}
220240

221241
impl<T, B, E> fmt::Debug for Connection<T, B, E>

src/proto/h2/client.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ where
442442
pub(crate) fn is_extended_connect_protocol_enabled(&self) -> bool {
443443
self.h2_tx.is_extended_connect_protocol_enabled()
444444
}
445+
pub(crate) fn current_max_send_streams(&self) -> usize {
446+
self.h2_tx.current_max_send_streams()
447+
}
448+
pub(crate) fn current_max_recv_streams(&self) -> usize {
449+
self.h2_tx.current_max_recv_streams()
450+
}
445451
}
446452

447453
pin_project! {

0 commit comments

Comments
 (0)