Skip to content

Commit

Permalink
fix(server): change Builder window size methods to be by-value
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Aug 21, 2019
1 parent b3774bd commit a22dabd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
4 changes: 2 additions & 2 deletions benches/end_to_end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ fn spawn_server(rt: &mut Runtime, opts: &Opts) -> SocketAddr {
let body = opts.response_body;
let srv = Server::bind(&addr)
.http2_only(opts.http2)
.http2_initial_stream_window_size_(opts.http2_stream_window)
.http2_initial_connection_window_size_(opts.http2_conn_window)
.http2_initial_stream_window_size(opts.http2_stream_window)
.http2_initial_connection_window_size(opts.http2_conn_window)
.serve(make_service_fn( move |_| async move {
Ok::<_, hyper::Error>(service_fn(move |req: Request<Body>| async move {
let mut req_body = req.into_body();
Expand Down
20 changes: 2 additions & 18 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,37 +307,21 @@ impl<I, E> Builder<I, E> {
self
}

// soft-deprecated? deprecation warning just seems annoying...
// reimplemented to take `self` instead of `&mut self`
#[doc(hidden)]
pub fn http2_initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
self.protocol.http2_initial_stream_window_size(sz.into());
self
}

// soft-deprecated? deprecation warning just seems annoying...
// reimplemented to take `self` instead of `&mut self`
#[doc(hidden)]
pub fn http2_initial_connection_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
self.protocol.http2_initial_connection_window_size(sz.into());
self
}

/// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2
/// stream-level flow control.
///
/// Default is 65,535
///
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE
pub fn http2_initial_stream_window_size_(mut self, sz: impl Into<Option<u32>>) -> Self {
pub fn http2_initial_stream_window_size(mut self, sz: impl Into<Option<u32>>) -> Self {
self.protocol.http2_initial_stream_window_size(sz.into());
self
}

/// Sets the max connection-level flow control for HTTP2
///
/// Default is 65,535
pub fn http2_initial_connection_window_size_(mut self, sz: impl Into<Option<u32>>) -> Self {
pub fn http2_initial_connection_window_size(mut self, sz: impl Into<Option<u32>>) -> Self {
self.protocol.http2_initial_connection_window_size(sz.into());
self
}
Expand Down

0 comments on commit a22dabd

Please sign in to comment.