Skip to content

Commit

Permalink
Add back max_pending_accept_reset_streams
Browse files Browse the repository at this point in the history
Adds back this function which was previously in hyper 0.14.

The original merge into hyper is
[here](https://github.com/hyperium/hyper/pull/3201/files/e8296d1c5bded88a508f1ca1f35791c30803182d)

This follows the original closely, with some minor wording improvements in the
outer line docs.

Closes hyperium/hyper#3461.
  • Loading branch information
allan2 committed Dec 12, 2023
1 parent 99409f5 commit bf5a793
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hyper-util"
version = "0.1.1"
version = "0.1.2"
description = "hyper utilities"
readme = "README.md"
homepage = "https://hyper.rs"
Expand Down
15 changes: 15 additions & 0 deletions src/client/legacy/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,21 @@ impl Builder {
self
}

/// Configures the maximum number of pending reset streams allowed before a GOAWAY is sent.
///
/// This defaults to the [`h2`](https://crates.io/crates/h2) default value, which is currently 20.
///
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn http2_max_pending_accept_reset_streams(
&mut self,
max: impl Into<Option<usize>>,
) -> &mut Self {
self.h2_builder.max_pending_accept_reset_streams = max.into();
self
}

/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
/// stream-level flow control.
///
Expand Down
10 changes: 10 additions & 0 deletions src/server/conn/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,16 @@ impl<E> Http2Builder<'_, E> {
}
}

/// Configures the maximum number of pending reset streams allowed before a GOAWAY is sent.
///
/// This defaults to the [`h2`](https://crates.io/crates/h2) default value, which is currently 20.
///
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
pub fn max_pending_accept_reset_streams(mut self, max: impl Into<Option<usize>>) -> Self {
self.protocol.http2_max_pending_accept_reset_streams(max);
self
}

/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
/// stream-level flow control.
///
Expand Down

0 comments on commit bf5a793

Please sign in to comment.