mirror of https://git.kore.io/kore.git
Do not start keymgr if no tls enabled servers are present
This commit is contained in:
parent
11cc5d304f
commit
b0cf42726d
27
src/worker.c
27
src/worker.c
|
@ -56,6 +56,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WORKER_SOLO_COUNT 2
|
#define WORKER_SOLO_COUNT 2
|
||||||
|
|
||||||
#define WORKER(id) \
|
#define WORKER(id) \
|
||||||
(struct kore_worker *)((u_int8_t *)kore_workers + \
|
(struct kore_worker *)((u_int8_t *)kore_workers + \
|
||||||
(sizeof(struct kore_worker) * id))
|
(sizeof(struct kore_worker) * id))
|
||||||
|
@ -96,14 +97,25 @@ kore_worker_init(void)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
struct kore_worker *kw;
|
struct kore_worker *kw;
|
||||||
|
struct kore_server *srv;
|
||||||
|
int keymgr;
|
||||||
u_int16_t i, cpu;
|
u_int16_t i, cpu;
|
||||||
|
|
||||||
|
keymgr = 0;
|
||||||
worker_no_lock = 0;
|
worker_no_lock = 0;
|
||||||
|
|
||||||
if (worker_count == 0)
|
if (worker_count == 0)
|
||||||
worker_count = cpu_count;
|
worker_count = cpu_count;
|
||||||
|
|
||||||
/* account for the key manager. */
|
/* Check if keymgr will be active. */
|
||||||
|
LIST_FOREACH(srv, &kore_servers, list) {
|
||||||
|
if (srv->tls) {
|
||||||
|
keymgr = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Account for the keymgr even if we don't end up starting it. */
|
||||||
worker_count += 1;
|
worker_count += 1;
|
||||||
|
|
||||||
len = sizeof(*accept_lock) +
|
len = sizeof(*accept_lock) +
|
||||||
|
@ -135,11 +147,16 @@ kore_worker_init(void)
|
||||||
kw->lb.offset = 0;
|
kw->lb.offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu = 0;
|
/* Start keymgr if required. */
|
||||||
for (i = 0; i < worker_count; i++) {
|
if (keymgr)
|
||||||
kore_worker_spawn(i, cpu++);
|
kore_worker_spawn(0, 0);
|
||||||
if (cpu == cpu_count)
|
|
||||||
|
/* Now start all the workers. */
|
||||||
|
cpu = 1;
|
||||||
|
for (i = 1; i < worker_count; i++) {
|
||||||
|
if (cpu >= cpu_count)
|
||||||
cpu = 0;
|
cpu = 0;
|
||||||
|
kore_worker_spawn(i, cpu++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue