feat(http2): add http2_max_send_buf_size option to client and server

This value is like a high-water mark. It applies per stream. Once a
stream has buffered that amount of bytes to send, it won't poll more
data from the `HttpBody` until the stream has been able to flush under
it.
This commit is contained in:
Sean McArthur
2021-12-08 15:03:00 -08:00
parent 84b78b6c87
commit bff977b73c
7 changed files with 68 additions and 2 deletions

View File

@@ -439,6 +439,20 @@ impl<I, E> Builder<I, E> {
self
}
/// Set the maximum write buffer size for each HTTP/2 stream.
///
/// Default is currently ~400KB, but may change.
///
/// # Panics
///
/// The value must be no larger than `u32::MAX`.
#[cfg(feature = "http2")]
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
pub fn http2_max_send_buf_size(mut self, max: usize) -> Self {
self.protocol.http2_max_send_buf_size(max);
self
}
/// Sets the `Executor` to deal with connection tasks.
///
/// Default is `tokio::spawn`.