Skip to content

Commit

Permalink
Fix external configuration handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Apr 1, 2024
1 parent 7e2e3d1 commit c89c3b4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
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 <[email protected]>"]
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

0 comments on commit c89c3b4

Please sign in to comment.