Add methods to {client, server}::Builder to set max concurrent streams (#150)

This PR adds `max_concurrent_streams()` methods to the client and server `Builder`s to set the `max_concurrent_streams` setting. I've added unit tests to ensure the correct SETTINGS frame is sent.

Closes #106
This commit is contained in:
Eliza Weisman
2017-10-10 17:36:45 -05:00
committed by GitHub
parent c6a233281a
commit 2fcf8c3740
8 changed files with 138 additions and 6 deletions

View File

@@ -194,6 +194,18 @@ impl Builder {
self
}
/// Set the maximum number of concurrent streams.
///
/// Servers can only limit the maximum number of streams that that the
/// client can initiate. See [Section 5.1.2] in the HTTP/2 spec for more
/// details.
///
/// [Section 5.1.2]: https://http2.github.io/http2-spec/#rfc.section.5.1.2
pub fn max_concurrent_streams(&mut self, max: u32) -> &mut Self {
self.settings.set_max_concurrent_streams(Some(max));
self
}
/// Bind an H2 server connection.
///
/// Returns a future which resolves to the connection value once the H2