Skip to content

Commit b33dbd2

Browse files
committed
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 (hyperium/hyper#3507). This commit completes the re-addition of this missing function.
1 parent 43ddd6d commit b33dbd2

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/client/legacy/client.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,22 @@ impl Builder {
12381238
self
12391239
}
12401240

1241+
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
1242+
///
1243+
/// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2).
1244+
/// As of v0.4.0, it is 20.
1245+
///
1246+
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
1247+
#[cfg(feature = "http2")]
1248+
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
1249+
pub fn http2_max_pending_accept_reset_streams(
1250+
&mut self,
1251+
max: impl Into<Option<usize>>,
1252+
) -> &mut Self {
1253+
self.h2_builder.max_pending_accept_reset_streams = max.into();
1254+
self
1255+
}
1256+
12411257
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
12421258
/// stream-level flow control.
12431259
///

src/server/conn/auto.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,17 @@ impl<E> Http2Builder<'_, E> {
551551
}
552552
}
553553

554+
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
555+
///
556+
/// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2).
557+
/// As of v0.4.0, it is 20.
558+
///
559+
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
560+
pub fn max_pending_accept_reset_streams(mut self, max: impl Into<Option<usize>>) -> Self {
561+
self.protocol.http2_max_pending_accept_reset_streams(max);
562+
self
563+
}
564+
554565
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
555566
/// stream-level flow control.
556567
///

0 commit comments

Comments
 (0)