Skip to content

Commit

Permalink
feat(client): remove http2_ prefixes from `client::conn::http2::Build…
Browse files Browse the repository at this point in the history
…er` methods

Refs: #3085
  • Loading branch information
Michael-J-Ward authored and seanmonstar committed Dec 28, 2022
1 parent 4cbaef7 commit 669df21
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
26 changes: 13 additions & 13 deletions src/client/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl Builder {
/// If not set, hyper will use a default.
///
/// [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>>) -> &mut Self {
pub fn initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
if let Some(sz) = sz.into() {
self.h2_builder.adaptive_window = false;
self.h2_builder.initial_stream_window_size = sz;
Expand All @@ -291,7 +291,7 @@ impl Builder {
/// Passing `None` will do nothing.
///
/// If not set, hyper will use a default.
pub fn http2_initial_connection_window_size(
pub fn initial_connection_window_size(
&mut self,
sz: impl Into<Option<u32>>,
) -> &mut Self {
Expand All @@ -305,9 +305,9 @@ impl Builder {
/// Sets whether to use an adaptive flow control.
///
/// Enabling this will override the limits set in
/// `http2_initial_stream_window_size` and
/// `http2_initial_connection_window_size`.
pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self {
/// `initial_stream_window_size` and
/// `initial_connection_window_size`.
pub fn adaptive_window(&mut self, enabled: bool) -> &mut Self {
use proto::h2::SPEC_WINDOW_SIZE;

self.h2_builder.adaptive_window = enabled;
Expand All @@ -323,7 +323,7 @@ impl Builder {
/// Passing `None` will do nothing.
///
/// If not set, hyper will use a default.
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
pub fn max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
if let Some(sz) = sz.into() {
self.h2_builder.max_frame_size = sz;
}
Expand All @@ -336,7 +336,7 @@ impl Builder {
/// Pass `None` to disable HTTP2 keep-alive.
///
/// Default is currently disabled.
pub fn http2_keep_alive_interval(
pub fn keep_alive_interval(
&mut self,
interval: impl Into<Option<Duration>>,
) -> &mut Self {
Expand All @@ -347,10 +347,10 @@ impl Builder {
/// Sets a timeout for receiving an acknowledgement of the keep-alive ping.
///
/// If the ping is not acknowledged within the timeout, the connection will
/// be closed. Does nothing if `http2_keep_alive_interval` is disabled.
/// be closed. Does nothing if `keep_alive_interval` is disabled.
///
/// Default is 20 seconds.
pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
self.h2_builder.keep_alive_timeout = timeout;
self
}
Expand All @@ -359,11 +359,11 @@ impl Builder {
///
/// If disabled, keep-alive pings are only sent while there are open
/// request/responses streams. If enabled, pings are also sent when no
/// streams are active. Does nothing if `http2_keep_alive_interval` is
/// streams are active. Does nothing if `keep_alive_interval` is
/// disabled.
///
/// Default is `false`.
pub fn http2_keep_alive_while_idle(&mut self, enabled: bool) -> &mut Self {
pub fn keep_alive_while_idle(&mut self, enabled: bool) -> &mut Self {
self.h2_builder.keep_alive_while_idle = enabled;
self
}
Expand All @@ -376,7 +376,7 @@ impl Builder {
/// The default value is determined by the `h2` crate.
///
/// [`h2::client::Builder::max_concurrent_reset_streams`]: https://docs.rs/h2/client/struct.Builder.html#method.max_concurrent_reset_streams
pub fn http2_max_concurrent_reset_streams(&mut self, max: usize) -> &mut Self {
pub fn max_concurrent_reset_streams(&mut self, max: usize) -> &mut Self {
self.h2_builder.max_concurrent_reset_streams = Some(max);
self
}
Expand All @@ -388,7 +388,7 @@ impl Builder {
/// # Panics
///
/// The value must be no larger than `u32::MAX`.
pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self {
pub fn max_send_buf_size(&mut self, max: usize) -> &mut Self {
assert!(max <= std::u32::MAX as usize);
self.h2_builder.max_send_buffer_size = max;
self
Expand Down
18 changes: 9 additions & 9 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1982,10 +1982,10 @@ mod conn {
let (_client, conn) = conn::http2::Builder::new()
.executor(TokioExecutor)
.timer(TokioTimer)
.http2_keep_alive_interval(Duration::from_secs(1))
.http2_keep_alive_timeout(Duration::from_secs(1))
.keep_alive_interval(Duration::from_secs(1))
.keep_alive_timeout(Duration::from_secs(1))
// enable while idle since we aren't sending requests
.http2_keep_alive_while_idle(true)
.keep_alive_while_idle(true)
.handshake::<_, hyper::body::Incoming>(io)
.await
.expect("http handshake");
Expand All @@ -2011,8 +2011,8 @@ mod conn {
let (mut client, conn) = conn::http2::Builder::new()
.executor(TokioExecutor)
.timer(TokioTimer)
.http2_keep_alive_interval(Duration::from_secs(1))
.http2_keep_alive_timeout(Duration::from_secs(1))
.keep_alive_interval(Duration::from_secs(1))
.keep_alive_timeout(Duration::from_secs(1))
.handshake::<_, hyper::body::Incoming>(io)
.await
.expect("http handshake");
Expand Down Expand Up @@ -2043,8 +2043,8 @@ mod conn {
let (mut client, conn) = conn::http2::Builder::new()
.executor(TokioExecutor)
.timer(TokioTimer)
.http2_keep_alive_interval(Duration::from_secs(1))
.http2_keep_alive_timeout(Duration::from_secs(1))
.keep_alive_interval(Duration::from_secs(1))
.keep_alive_timeout(Duration::from_secs(1))
.handshake(io)
.await
.expect("http handshake");
Expand Down Expand Up @@ -2103,8 +2103,8 @@ mod conn {
let (mut client, conn) = conn::http2::Builder::new()
.executor(TokioExecutor)
.timer(TokioTimer)
.http2_keep_alive_interval(Duration::from_secs(1))
.http2_keep_alive_timeout(Duration::from_secs(1))
.keep_alive_interval(Duration::from_secs(1))
.keep_alive_timeout(Duration::from_secs(1))
.handshake(io)
.await
.expect("http handshake");
Expand Down

0 comments on commit 669df21

Please sign in to comment.