Skip to content

Commit 5de2de5

Browse files
authored
Naming for ServiceConfig and ClientBuilder (#72)
1 parent 14e026d commit 5de2de5

File tree

4 files changed

+21
-25
lines changed

4 files changed

+21
-25
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changes
22

3+
## [3.1.0] - 2025-12-04
4+
5+
* Refactor stream ID validation and error handling #71
6+
7+
* Naming for ServiceConfig and ClientBuilder
8+
39
## [3.0.0-pre.1] - 2025-11-30
410

511
* Set default max concurrent streams

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-h2"
3-
version = "3.0.0"
3+
version = "3.1.0"
44
license = "MIT OR Apache-2.0"
55
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
66
description = "An HTTP/2 client and server"
@@ -28,7 +28,7 @@ ntex-io = "3"
2828
ntex-http = "1"
2929
ntex-bytes = "1"
3030
ntex-codec = "1"
31-
ntex-service = "3.6.2"
31+
ntex-service = "3.7"
3232
ntex-util = "3"
3333

3434
ahash = "0.8.12"
@@ -49,7 +49,7 @@ walkdir = "2.3.2"
4949
serde = "1"
5050
serde_json = "1"
5151

52-
ntex = { version = "3.0.0-pre.2", features = ["openssl"] }
52+
ntex = { version = "3.0.0-pre.3", features = ["openssl"] }
5353
ntex-tls = { version = "3", features = ["openssl"] }
5454
openssl = "0.10"
5555

src/client/pool.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn notify(waiters: &mut VecDeque<pool::Sender<()>>) {
4444
impl Client {
4545
#[inline]
4646
/// Configure and build client
47-
pub fn build<A, U, T, F>(addr: U, connector: F) -> ClientBuilder<A, T>
47+
pub fn builder<A, U, T, F>(addr: U, connector: F) -> ClientBuilder<A, T>
4848
where
4949
A: Address + Clone,
5050
F: IntoServiceFactory<T, Connect<A>, SharedCfg>,
@@ -55,16 +55,6 @@ impl Client {
5555
ClientBuilder::new(addr, connector)
5656
}
5757

58-
#[inline]
59-
/// Configure and build client
60-
pub fn with_default<A, U>(addr: U) -> ClientBuilder<A, DefaultConnector<A>>
61-
where
62-
A: Address + Clone,
63-
Connect<A>: From<U>,
64-
{
65-
ClientBuilder::with_default(addr)
66-
}
67-
6858
/// Send request to the peer
6959
pub async fn send(
7060
&self,
@@ -437,7 +427,7 @@ where
437427
IoBoxed: From<T::Response>,
438428
{
439429
/// Finish configuration process and create connections pool.
440-
pub async fn finish(self, cfg: SharedCfg) -> Result<Client, T::InitError> {
430+
pub async fn build(self, cfg: SharedCfg) -> Result<Client, T::InitError> {
441431
let connect = self.connect;
442432
let svc = Pipeline::new(self.connector.create(cfg).await?);
443433

src/config.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl ServiceConfig {
9090
/// details, see [`FlowControl`].
9191
///
9292
/// The default value is 65,535.
93-
pub fn initial_window_size(mut self, size: u32) -> Self {
93+
pub fn set_initial_window_size(mut self, size: u32) -> Self {
9494
self.window_sz = size;
9595
self.window_sz_threshold = ((size as f32) / 3.0) as u32;
9696
self.settings.set_initial_window_size(Some(size));
@@ -106,7 +106,7 @@ impl ServiceConfig {
106106
/// The default value is 1Mb.
107107
///
108108
/// [`FlowControl`]: ../struct.FlowControl.html
109-
pub fn initial_connection_window_size(mut self, size: u32) -> Self {
109+
pub fn set_initial_connection_window_size(mut self, size: u32) -> Self {
110110
assert!(size <= consts::MAX_WINDOW_SIZE);
111111
self.connection_window_sz = size;
112112
self.connection_window_sz_threshold = ((size as f32) / 4.0) as u32;
@@ -126,7 +126,7 @@ impl ServiceConfig {
126126
///
127127
/// This function panics if `max` is not within the legal range specified
128128
/// above.
129-
pub fn max_frame_size(mut self, max: u32) -> Self {
129+
pub fn set_max_frame_size(mut self, max: u32) -> Self {
130130
self.settings.set_max_frame_size(max);
131131
self
132132
}
@@ -142,15 +142,15 @@ impl ServiceConfig {
142142
/// buffered to decode HEADERS frames.
143143
///
144144
/// By default value is set to 48Kb.
145-
pub fn max_header_list_size(mut self, max: u32) -> Self {
145+
pub fn set_max_header_list_size(mut self, max: u32) -> Self {
146146
self.settings.set_max_header_list_size(Some(max));
147147
self
148148
}
149149

150150
/// Sets the max number of continuation frames for HEADERS
151151
///
152152
/// By default value is set to 5
153-
pub fn max_header_continuation_frames(mut self, max: usize) -> Self {
153+
pub fn set_max_header_continuation_frames(mut self, max: usize) -> Self {
154154
self.max_header_continuations = max;
155155
self
156156
}
@@ -178,7 +178,7 @@ impl ServiceConfig {
178178
/// See [Section 5.1.2] in the HTTP/2 spec for more details.
179179
///
180180
/// [Section 5.1.2]: https://http2.github.io/http2-spec/#rfc.section.5.1.2
181-
pub fn max_concurrent_streams(mut self, max: u32) -> Self {
181+
pub fn set_max_concurrent_streams(mut self, max: u32) -> Self {
182182
self.remote_max_concurrent_streams = Some(max);
183183
self.settings.set_max_concurrent_streams(Some(max));
184184
self
@@ -205,7 +205,7 @@ impl ServiceConfig {
205205
/// error, forcing the connection to terminate.
206206
///
207207
/// The default value is 32.
208-
pub fn max_concurrent_reset_streams(mut self, val: usize) -> Self {
208+
pub fn set_max_concurrent_reset_streams(mut self, val: usize) -> Self {
209209
self.reset_max = val;
210210
self
211211
}
@@ -231,7 +231,7 @@ impl ServiceConfig {
231231
/// error, forcing the connection to terminate.
232232
///
233233
/// The default value is 30 seconds.
234-
pub fn reset_stream_duration(mut self, dur: Seconds) -> Self {
234+
pub fn set_reset_stream_duration(mut self, dur: Seconds) -> Self {
235235
self.reset_duration = dur.into();
236236
self
237237
}
@@ -251,15 +251,15 @@ impl ServiceConfig {
251251
/// Hadnshake includes receiving preface and completing connection preparation.
252252
///
253253
/// By default handshake timeuot is 5 seconds.
254-
pub fn handshake_timeout(mut self, timeout: Seconds) -> Self {
254+
pub fn set_handshake_timeout(mut self, timeout: Seconds) -> Self {
255255
self.handshake_timeout = timeout;
256256
self
257257
}
258258

259259
/// Set ping timeout.
260260
///
261261
/// By default ping time-out is set to 60 seconds.
262-
pub fn ping_timeout(mut self, timeout: Seconds) -> Self {
262+
pub fn set_ping_timeout(mut self, timeout: Seconds) -> Self {
263263
self.ping_timeout = timeout;
264264
self
265265
}

0 commit comments

Comments
 (0)