Skip to content

Commit 330ddf1

Browse files
authoredApr 1, 2024··
feat(client): add max_pending_accept_reset_streams HTTP2 option (#3617)
1 parent 6ecf852 commit 330ddf1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎src/client/conn/http2.rs

+11
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,17 @@ where
403403
self
404404
}
405405

406+
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
407+
///
408+
/// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2).
409+
/// As of v0.4.0, it is 20.
410+
///
411+
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
412+
pub fn max_pending_accept_reset_streams(&mut self, max: impl Into<Option<usize>>) -> &mut Self {
413+
self.h2_builder.max_pending_accept_reset_streams = max.into();
414+
self
415+
}
416+
406417
/// Constructs a connection with the configured options and IO.
407418
/// See [`client::conn`](crate::client::conn) for more.
408419
///

‎src/proto/h2/client.rs

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub(crate) struct Config {
7373
pub(crate) keep_alive_while_idle: bool,
7474
pub(crate) max_concurrent_reset_streams: Option<usize>,
7575
pub(crate) max_send_buffer_size: usize,
76+
pub(crate) max_pending_accept_reset_streams: Option<usize>,
7677
}
7778

7879
impl Default for Config {
@@ -88,6 +89,7 @@ impl Default for Config {
8889
keep_alive_while_idle: false,
8990
max_concurrent_reset_streams: None,
9091
max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE,
92+
max_pending_accept_reset_streams: None,
9193
}
9294
}
9395
}
@@ -104,6 +106,9 @@ fn new_builder(config: &Config) -> Builder {
104106
if let Some(max) = config.max_concurrent_reset_streams {
105107
builder.max_concurrent_reset_streams(max);
106108
}
109+
if let Some(max) = config.max_pending_accept_reset_streams {
110+
builder.max_pending_accept_reset_streams(max);
111+
}
107112
builder
108113
}
109114

0 commit comments

Comments
 (0)
Please sign in to comment.