From 1c49c39dec52a8140f9c2e78787c4334907b0694 Mon Sep 17 00:00:00 2001 From: Allan Zhang Date: Wed, 3 Jan 2024 01:26:13 -0500 Subject: [PATCH] Add `max_pending_accept_reset_streams` This function was in 0.14 but missed in 1.0. The original function was merged [here](https://github.com/hyperium/hyper/pull/3201/files/e8296d1c5bded88a508f1ca1f35791c30803182d) This commit simply copies directly from it. The config part has been merged into hyper 1.0 (https://github.com/hyperium/hyper/pull/3507). This commit completes the re-addition of this missing function. --- Cargo.toml | 1 + src/server/conn/auto.rs | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9ec456a..a657420 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,3 +75,4 @@ __internal_happy_eyeballs_tests = [] [[example]] name = "client" required-features = ["client-legacy", "http1", "tokio"] + diff --git a/src/server/conn/auto.rs b/src/server/conn/auto.rs index 7240808..9ddd406 100644 --- a/src/server/conn/auto.rs +++ b/src/server/conn/auto.rs @@ -661,6 +661,17 @@ impl Http2Builder<'_, E> { Http1Builder { inner: self.inner } } + /// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent. + /// + /// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2). + /// As of v0.4.0, it is 20. + /// + /// See for more information. + pub fn max_pending_accept_reset_streams(&mut self, max: impl Into>) -> &mut Self { + self.inner.http2.max_pending_accept_reset_streams(max); + self + } + /// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2 /// stream-level flow control. ///