Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix external configuration handling #332

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ntex-server/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [1.0.5] - 2024-04-02

* Fix external configuration handling

## [1.0.4] - 2024-03-30

* Fix signals support #324
Expand Down
2 changes: 1 addition & 1 deletion ntex-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-server"
version = "1.0.4"
version = "1.0.5"
authors = ["ntex contributors <team@ntex.rs>"]
description = "Server for ntex framework"
keywords = ["network", "framework", "async", "futures"]
Expand Down
20 changes: 11 additions & 9 deletions ntex-server/src/net/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,17 @@ impl FactoryService for ConfiguredService {
let mut services = mem::take(&mut rt.0.borrow_mut().services);

let mut res = Vec::new();
while let Some(Some(svc)) = services.pop() {
for entry in names.values() {
if entry.idx == services.len() {
res.push(NetService {
pool: entry.pool,
tokens: entry.tokens.clone(),
factory: svc,
});
break;
while let Some(svc) = services.pop() {
if let Some(svc) = svc {
for entry in names.values() {
if entry.idx == services.len() {
res.push(NetService {
pool: entry.pool,
tokens: entry.tokens.clone(),
factory: svc,
});
break;
}
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions ntex-server/src/net/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl ServiceFactory<ServerMessage> for StreamService {
for info in &self.services {
match info.factory.create(()).await {
Ok(svc) => {
log::debug!("Constructed server service for {:?}", info.tokens);
services.push(svc);
let idx = services.len() - 1;
for (token, tag) in &info.tokens {
Expand All @@ -123,12 +124,10 @@ impl ServiceFactory<ServerMessage> for StreamService {
}
}

let conns = MAX_CONNS_COUNTER.with(|conns| conns.priv_clone());

Ok(StreamServiceImpl {
tokens,
services,
conns,
conns: MAX_CONNS_COUNTER.with(|conns| conns.priv_clone()),
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions ntex-server/src/wrk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ impl<T> Worker<T> {
let _ = spawn(async move {
log::info!("Starting worker {:?}", id);

log::debug!("Creating server instance in {:?} worker", id);
log::debug!("Creating server instance in {:?}", id);
let factory = cfg.create().await;
log::debug!("Server instance has been created in {:?} worker", id);
log::debug!("Server instance has been created in {:?}", id);

match create(id, rx1, rx2, factory, avail_tx).await {
Ok((svc, wrk)) => {
Expand Down
2 changes: 1 addition & 1 deletion ntex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ntex-service = "2.0.1"
ntex-macros = "0.1.3"
ntex-util = "1.0.1"
ntex-bytes = "0.1.24"
ntex-server = "1.0.3"
ntex-server = "1.0.5"
ntex-h2 = "0.5.2"
ntex-rt = "0.4.12"
ntex-io = "1.0.1"
Expand Down
Loading