Skip to content

Commit 2c6ac9d

Browse files
committed
just waiting for h2 release...
1 parent a9d4e83 commit 2c6ac9d

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/proto/h2/server.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const DEFAULT_CONN_WINDOW: u32 = 1024 * 1024; // 1mb
3535
const DEFAULT_STREAM_WINDOW: u32 = 1024 * 1024; // 1mb
3636
const DEFAULT_MAX_FRAME_SIZE: u32 = 1024 * 16; // 16kb
3737
const DEFAULT_MAX_SEND_BUF_SIZE: usize = 1024 * 400; // 400kb
38-
// 16 MB "sane default" taken from golang http2
38+
// 16 MB "sane default" taken from golang http2
3939
const DEFAULT_SETTINGS_MAX_HEADER_LIST_SIZE: u32 = 16 << 20;
4040

4141
#[derive(Clone, Debug)]
@@ -46,6 +46,7 @@ pub(crate) struct Config {
4646
pub(crate) max_frame_size: u32,
4747
pub(crate) enable_connect_protocol: bool,
4848
pub(crate) max_concurrent_streams: Option<u32>,
49+
pub(crate) max_pending_accept_reset_streams: Option<usize>,
4950
#[cfg(feature = "runtime")]
5051
pub(crate) keep_alive_interval: Option<Duration>,
5152
#[cfg(feature = "runtime")]
@@ -63,6 +64,7 @@ impl Default for Config {
6364
max_frame_size: DEFAULT_MAX_FRAME_SIZE,
6465
enable_connect_protocol: false,
6566
max_concurrent_streams: None,
67+
max_pending_accept_reset_streams: None,
6668
#[cfg(feature = "runtime")]
6769
keep_alive_interval: None,
6870
#[cfg(feature = "runtime")]
@@ -125,6 +127,9 @@ where
125127
if let Some(max) = config.max_concurrent_streams {
126128
builder.max_concurrent_streams(max);
127129
}
130+
if let Some(max) = config.max_pending_accept_reset_streams {
131+
todo!()
132+
}
128133
if config.enable_connect_protocol {
129134
builder.enable_connect_protocol();
130135
}
@@ -503,7 +508,6 @@ where
503508
}
504509
}
505510

506-
507511
if !body.is_end_stream() {
508512
// automatically set Content-Length from body...
509513
if let Some(len) = body.size_hint().exact() {

src/server/conn.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,17 @@ impl<E> Http<E> {
394394
self
395395
}
396396

397+
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
398+
///
399+
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
400+
#[cfg(feature = "http2")]
401+
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
402+
pub fn http2_max_pending_accept_reset_streams(&mut self, max: usize) -> &mut Self {
403+
self.h2_builder.max_pending_accept_reset_streams = Some(max);
404+
405+
self
406+
}
407+
397408
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
398409
/// stream-level flow control.
399410
///

src/server/server.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@ impl<I, E> Builder<I, E> {
373373
self
374374
}
375375

376+
/// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
377+
///
378+
/// See <https://github.com/hyperium/hyper/issues/2877> for more information.
379+
#[cfg(feature = "http2")]
380+
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
381+
pub fn http2_max_pending_accept_reset_streams(mut self, max: usize) -> Self {
382+
self.protocol.http2_max_pending_accept_reset_streams(max);
383+
self
384+
}
385+
376386
/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
377387
/// stream-level flow control.
378388
///

0 commit comments

Comments
 (0)