From 8bdf97cc9c35c21d5e4f3dfb462a16ec313f4e75 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 1 Oct 2021 11:42:17 -0400 Subject: [PATCH] set the new value. this will be used after the server starts, because that's when the callback is hit. It won't (yet) be used in references as the configuration files are being read. --- src/lib/server/main_config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index 64736601ff..6fa282a565 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -401,6 +401,8 @@ static int num_workers_parse(TALLOC_CTX *ctx, void *out, void *parent, * discover it automatically. */ if (value == 0) { + char *strvalue; + value = fr_hw_num_cores_active(); /* @@ -418,6 +420,10 @@ static int num_workers_parse(TALLOC_CTX *ctx, void *out, void *parent, value -= conf->max_networks; } + strvalue = talloc_asprintf(ci, "%u", value); + (void) cf_pair_replace(cf_item_to_section(cf_parent(ci)), cf_item_to_pair(ci), strvalue); + talloc_free(strvalue); + /* * Otherwise just create as many * workers as we have cores. -- 2.47.2