Skip to content

Commit 67b97b4

Browse files
authored
Configure system name (#726)
1 parent 512a5b8 commit 67b97b4

File tree

34 files changed

+341
-238
lines changed

34 files changed

+341
-238
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repository = "https://github.com/ntex-rs/ntex"
2323
documentation = "https://docs.rs/ntex/"
2424
license = "MIT OR Apache-2.0"
2525
edition = "2024"
26-
rust-version = "1.85"
26+
rust-version = "1.86"
2727

2828
[patch.crates-io]
2929
ntex = { path = "ntex" }
@@ -42,19 +42,19 @@ ntex-macros = { path = "ntex-macros" }
4242
ntex-util = { path = "ntex-util" }
4343

4444
[workspace.dependencies]
45-
ntex = "3.0.0-pre.13"
45+
ntex = "3.0.0-pre.14"
4646
ntex-bytes = "1.4.1"
4747
ntex-codec = "1.1.0"
4848
ntex-io = "3.5.0"
4949
ntex-dispatcher = "3.0.0"
5050
ntex-net = "3.5.1"
5151
ntex-http = "1.0.0"
5252
ntex-router = "1.0.0"
53-
ntex-rt = "3.4.1"
54-
ntex-server = "3.5.0"
53+
ntex-rt = "3.5.0"
54+
ntex-server = "3.6.0"
5555
ntex-service = "4.0.0"
5656
ntex-tls = "3.2.0"
57-
ntex-macros = "3.0.0"
57+
ntex-macros = "3.1.0"
5858
ntex-util = "3.4.0"
5959
ntex-h2 = "3.4.0"
6060

ntex-io/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation = "https://docs.rs/ntex-io/"
1010
categories = ["network-programming", "asynchronous"]
1111
license = "MIT OR Apache-2.0"
1212
edition = "2024"
13-
rust-version = "1.86"
13+
rust-version = "1.88"
1414

1515
[lib]
1616
name = "ntex_io"

ntex-io/src/dispatcher.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ where
194194
let slf = &mut this.inner;
195195

196196
// handle service response future
197-
if let Some(fut) = slf.response.as_mut() {
198-
if let Poll::Ready(item) = Pin::new(fut).poll(cx) {
199-
slf.shared.handle_result(item, &slf.shared.io, false);
200-
slf.response = None;
201-
}
197+
if let Some(fut) = slf.response.as_mut()
198+
&& let Poll::Ready(item) = Pin::new(fut).poll(cx)
199+
{
200+
slf.shared.handle_result(item, &slf.shared.io, false);
201+
slf.response = None;
202202
}
203203

204204
loop {
@@ -280,12 +280,11 @@ where
280280
slf.shared.io.stop_timer();
281281

282282
// service may relay on poll_ready for response results
283-
if !slf.shared.contains(Flags::READY_ERR) {
284-
if let Poll::Ready(res) = slf.shared.service.poll_ready(cx) {
285-
if res.is_err() {
286-
slf.shared.insert_flags(Flags::READY_ERR);
287-
}
288-
}
283+
if !slf.shared.contains(Flags::READY_ERR)
284+
&& let Poll::Ready(res) = slf.shared.service.poll_ready(cx)
285+
&& res.is_err()
286+
{
287+
slf.shared.insert_flags(Flags::READY_ERR);
289288
}
290289

291290
if slf.shared.inflight.get() == 0 {

ntex-io/src/testing.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ impl IoStream for IoTest {
361361

362362
impl Handle for Rc<IoTest> {
363363
fn query(&self, id: any::TypeId) -> Option<Box<dyn any::Any>> {
364-
if id == any::TypeId::of::<types::PeerAddr>() {
365-
if let Some(addr) = self.peer_addr {
366-
return Some(Box::new(types::PeerAddr(addr)));
367-
}
364+
if id == any::TypeId::of::<types::PeerAddr>()
365+
&& let Some(addr) = self.peer_addr
366+
{
367+
return Some(Box::new(types::PeerAddr(addr)));
368368
}
369369
None
370370
}

ntex-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-macros"
3-
version = "3.0.0"
3+
version = "3.1.0"
44
description = "ntex proc macros"
55
readme = "README.md"
66
authors = ["ntex contributors <team@ntex.rs>"]

ntex-macros/src/lib.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ pub fn rt_main(_: TokenStream, item: TokenStream) -> TokenStream {
216216
(quote! {
217217
#(#attrs)*
218218
#vis #sig {
219-
ntex::rt::System::build().name(stringify!(#name))
219+
ntex::rt::System::build()
220+
.name(stringify!(#name))
220221
.build(ntex::rt::DefaultRuntime)
221222
.block_on(async move { #body })
222223
}
@@ -264,7 +265,9 @@ pub fn rt_test(_: TokenStream, item: TokenStream) -> TokenStream {
264265
#(#attrs)*
265266
fn #name() #ret {
266267
ntex::util::enable_test_logging();
267-
ntex::rt::System::build().name("test")
268+
ntex::rt::System::build()
269+
.name(stringify!(#name))
270+
.testing()
268271
.build(ntex::rt::DefaultRuntime)
269272
.block_on(async { #body })
270273
}
@@ -275,7 +278,9 @@ pub fn rt_test(_: TokenStream, item: TokenStream) -> TokenStream {
275278
#(#attrs)*
276279
fn #name() #ret {
277280
ntex::util::enable_test_logging();
278-
ntex::rt::System::build().name("test")
281+
ntex::rt::System::build()
282+
.name(stringify!(#name))
283+
.testing()
279284
.build(ntex::rt::DefaultRuntime)
280285
.block_on(async { #body })
281286
}
@@ -325,7 +330,9 @@ pub fn rt_test2(_: TokenStream, item: TokenStream) -> TokenStream {
325330
quote! {
326331
#(#attrs)*
327332
fn #name() #ret {
328-
ntex_rt::System::build().name("test")
333+
ntex_rt::System::build()
334+
.name(stringify!(#name))
335+
.testing()
329336
.build(ntex::rt::DefaultRuntime)
330337
.block_on(async { #body })
331338
}
@@ -335,7 +342,9 @@ pub fn rt_test2(_: TokenStream, item: TokenStream) -> TokenStream {
335342
#[test]
336343
#(#attrs)*
337344
fn #name() #ret {
338-
ntex_rt::System::build().name("test")
345+
ntex_rt::System::build()
346+
.name(stringify!(#name))
347+
.testing()
339348
.build(ntex::rt::DefaultRuntime)
340349
.block_on(async { #body })
341350
}
@@ -386,7 +395,9 @@ pub fn rt_test_internal(_: TokenStream, item: TokenStream) -> TokenStream {
386395
#(#attrs)*
387396
fn #name() #ret {
388397
crate::util::enable_test_logging();
389-
ntex_rt::System::build().name("test")
398+
ntex_rt::System::build()
399+
.name(stringify!(#name))
400+
.testing()
390401
.build(crate::rt::DefaultRuntime)
391402
.block_on(async { #body })
392403
}
@@ -397,7 +408,9 @@ pub fn rt_test_internal(_: TokenStream, item: TokenStream) -> TokenStream {
397408
#(#attrs)*
398409
fn #name() #ret {
399410
crate::util::enable_test_logging();
400-
ntex_rt::System::build().name("test")
411+
ntex_rt::System::build()
412+
.name(stringify!(#name))
413+
.testing()
401414
.build(crate::rt::DefaultRuntime)
402415
.block_on(async { #body })
403416
}

ntex-net/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation = "https://docs.rs/ntex-connect/"
1010
categories = ["network-programming", "asynchronous"]
1111
license = "MIT OR Apache-2.0"
1212
edition = "2024"
13-
rust-version = "1.86"
13+
rust-version = "1.88"
1414

1515
[lib]
1616
name = "ntex_net"

ntex-net/src/uring/stream.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,10 @@ impl Handler for StreamOpsHandler {
279279
}
280280
}
281281
Operation::Poll { id } => {
282-
if let Some(item) = st.streams.get_mut(id) {
283-
if !item.flags.contains(Flags::RD_MORE) && !item.ctx.is_stopped() {
282+
if let Some(item) = st.streams.get_mut(id)
283+
&& !item.flags.contains(Flags::RD_MORE) && !item.ctx.is_stopped() {
284284
item.ctx.stop(res.err());
285285
}
286-
}
287286
}
288287
Operation::Shutdown { tx } => {
289288
if let Some(tx) = tx {
@@ -400,12 +399,12 @@ impl StreamOpsStorage {
400399

401400
fn pause_read(&mut self, id: usize, api: &DriverApi) {
402401
let item = &mut self.streams[id];
403-
if let Some(rd_op) = item.rd_op {
404-
if !item.flags.contains(Flags::RD_CANCELING) {
405-
item.flags.insert(Flags::RD_CANCELING);
406-
api.cancel(rd_op.get());
407-
log::trace!("{}: Recv to pause ({:?})", item.tag(), item.fd());
408-
}
402+
if let Some(rd_op) = item.rd_op
403+
&& !item.flags.contains(Flags::RD_CANCELING)
404+
{
405+
item.flags.insert(Flags::RD_CANCELING);
406+
api.cancel(rd_op.get());
407+
log::trace!("{}: Recv to pause ({:?})", item.tag(), item.fd());
409408
}
410409
}
411410
}

ntex-rt/CHANGES.md

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

3+
## [3.5.0] - 2026-01-28
4+
5+
* Use system name for arbiters
6+
7+
* Add testing flag for system
8+
39
## [3.4.0] - 2026-01-03
410

511
* Refactor io driver management

ntex-rt/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-rt"
3-
version = "3.4.1"
3+
version = "3.5.0"
44
authors = ["ntex contributors <team@ntex.rs>"]
55
description = "ntex runtime"
66
keywords = ["network", "framework", "async", "futures"]
@@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"]
1111
license = "MIT OR Apache-2.0"
1212
build = "build.rs"
1313
edition = "2024"
14-
rust-version = "1.86"
14+
rust-version = "1.88"
1515

1616
[lib]
1717
name = "ntex_rt"

0 commit comments

Comments
 (0)