summaryrefslogtreecommitdiffstats
path: root/contrib/unbound/daemon/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/unbound/daemon/daemon.c')
-rw-r--r--contrib/unbound/daemon/daemon.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/unbound/daemon/daemon.c b/contrib/unbound/daemon/daemon.c
index f693a02..e763f72 100644
--- a/contrib/unbound/daemon/daemon.c
+++ b/contrib/unbound/daemon/daemon.c
@@ -84,7 +84,7 @@
#include "util/random.h"
#include "util/tube.h"
#include "util/net_help.h"
-#include "ldns/keyraw.h"
+#include "sldns/keyraw.h"
#include <signal.h>
/** How many quit requests happened. */
@@ -399,6 +399,12 @@ daemon_create_workers(struct daemon* daemon)
verbose(VERB_ALGO, "total of %d outgoing ports available", numport);
daemon->num = (daemon->cfg->num_threads?daemon->cfg->num_threads:1);
+ if(daemon->reuseport && (int)daemon->num < (int)daemon->num_ports) {
+ log_warn("cannot reduce num-threads to %d because so-reuseport "
+ "so continuing with %d threads.", (int)daemon->num,
+ (int)daemon->num_ports);
+ daemon->num = (int)daemon->num_ports;
+ }
daemon->workers = (struct worker**)calloc((size_t)daemon->num,
sizeof(struct worker*));
if(daemon->cfg->dnstap) {
@@ -464,7 +470,7 @@ thread_start(void* arg)
#endif
#ifdef SO_REUSEPORT
if(worker->daemon->cfg->so_reuseport)
- port_num = worker->thread_num;
+ port_num = worker->thread_num % worker->daemon->num_ports;
else
port_num = 0;
#endif
OpenPOWER on IntegriCloud