kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit f2f5a3742f05eee246e82b56463fd52851664486
parent cb489ce80f888f51a86f2827c825b07839f696f6
Author: Joris Vink <joris@coders.se>
Date:   Sun, 31 Jan 2016 16:48:17 +0100

Let SIGTERM properly shutdown Kore as well.

Diffstat:
src/kore.c | 2++
src/worker.c | 13+++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/kore.c b/src/kore.c @@ -179,6 +179,7 @@ main(int argc, char *argv[]) sig_recv = 0; signal(SIGHUP, kore_signal); signal(SIGQUIT, kore_signal); + signal(SIGTERM, kore_signal); if (foreground) signal(SIGINT, kore_signal); @@ -399,6 +400,7 @@ kore_server_start(void) break; case SIGINT: case SIGQUIT: + case SIGTERM: quit = 1; kore_worker_dispatch_signal(sig_recv); continue; diff --git a/src/worker.c b/src/worker.c @@ -270,6 +270,7 @@ kore_worker_entry(struct kore_worker *kw) sig_recv = 0; signal(SIGHUP, kore_signal); signal(SIGQUIT, kore_signal); + signal(SIGTERM, kore_signal); signal(SIGPIPE, SIG_IGN); if (foreground) @@ -306,10 +307,18 @@ kore_worker_entry(struct kore_worker *kw) for (;;) { if (sig_recv != 0) { - if (sig_recv == SIGHUP) + switch (sig_recv) { + case SIGHUP: kore_module_reload(1); - else if (sig_recv == SIGQUIT || sig_recv == SIGINT) + break; + case SIGQUIT: + case SIGINT: + case SIGTERM: quit = 1; + break; + default: + break; + } sig_recv = 0; }