aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_resolv_gai.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/posix/posix_resolv_gai.c')
-rw-r--r--src/platform/posix/posix_resolv_gai.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/platform/posix/posix_resolv_gai.c b/src/platform/posix/posix_resolv_gai.c
index f522499e..f85c27c1 100644
--- a/src/platform/posix/posix_resolv_gai.c
+++ b/src/platform/posix/posix_resolv_gai.c
@@ -8,6 +8,7 @@
// found online at https://opensource.org/licenses/MIT.
//
+#include "core/init.h"
#include "core/nng_impl.h"
#ifdef NNG_USE_POSIX_RESOLV_GAI
@@ -42,7 +43,7 @@ static nni_cv resolv_cv = NNI_CV_INITIALIZER(&resolv_mtx);
static bool resolv_fini = false;
static nni_list resolv_aios;
static nni_thr *resolv_thrs;
-static int resolv_num_thr;
+static int16_t resolv_num_thr;
typedef struct resolv_item resolv_item;
struct resolv_item {
@@ -477,22 +478,17 @@ nni_parse_ip_port(const char *addr, nni_sockaddr *sa)
}
int
-nni_posix_resolv_sysinit(void)
+nni_posix_resolv_sysinit(nng_init_params *params)
{
resolv_fini = false;
nni_aio_list_init(&resolv_aios);
-#ifndef NNG_RESOLV_CONCURRENCY
-#define NNG_RESOLV_CONCURRENCY 4
-#endif
-
- resolv_num_thr = (int) nni_init_get_param(
- NNG_INIT_NUM_RESOLVER_THREADS, NNG_RESOLV_CONCURRENCY);
+ resolv_num_thr = params->num_resolver_threads;
if (resolv_num_thr < 1) {
resolv_num_thr = 1;
}
+ params->num_resolver_threads = resolv_num_thr;
// no limit on the maximum for now
- nni_init_set_effective(NNG_INIT_NUM_RESOLVER_THREADS, resolv_num_thr);
resolv_thrs = NNI_ALLOC_STRUCTS(resolv_thrs, resolv_num_thr);
if (resolv_thrs == NULL) {
return (NNG_ENOMEM);