kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 40a81a17bab913ad3be6bc3a6b003b546c53ee02
parent 0726a26c0cd1d51d1ae8c49a7eee95b7ca19d795
Author: Joris Vink <joris@coders.se>
Date:   Tue, 17 Jul 2018 14:28:43 +0200

remove kore_module_handle for NOHTTP=1 builds.

Diffstat:
include/kore/kore.h | 26+++++++++++++++-----------
src/domain.c | 4++++
src/module.c | 4++++
src/worker.c | 12+++++++++---
4 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/include/kore/kore.h b/include/kore/kore.h @@ -341,21 +341,21 @@ struct kore_module { TAILQ_ENTRY(kore_module) list; }; -struct kore_module_handle { - char *path; - char *func; - int type; - int errors; - regex_t rctx; - struct kore_domain *dom; - struct kore_runtime_call *rcall; #if !defined(KORE_NO_HTTP) +struct kore_module_handle { + char *path; + char *func; + int type; + int errors; + regex_t rctx; + struct kore_domain *dom; + struct kore_runtime_call *rcall; struct kore_auth *auth; int methods; TAILQ_HEAD(, kore_handler_params) params; -#endif TAILQ_ENTRY(kore_module_handle) list; }; +#endif struct kore_worker { u_int8_t id; @@ -380,7 +380,9 @@ struct kore_domain { SSL_CTX *ssl_ctx; int x509_verify_depth; #endif +#if !defined(KORE_NO_HTTP) TAILQ_HEAD(, kore_module_handle) handlers; +#endif TAILQ_ENTRY(kore_domain) list; }; @@ -689,9 +691,13 @@ void kore_domain_keymgr_init(void); void kore_module_load(const char *, const char *, int); void kore_domain_callback(void (*cb)(struct kore_domain *)); void kore_domain_tlsinit(struct kore_domain *, const void *, size_t); +#if !defined(KORE_NO_HTTP) int kore_module_handler_new(const char *, const char *, const char *, const char *, int); void kore_module_handler_free(struct kore_module_handle *); +struct kore_module_handle *kore_module_handler_find(const char *, + const char *); +#endif struct kore_runtime_call *kore_runtime_getcall(const char *); @@ -712,8 +718,6 @@ void kore_runtime_wsmessage(struct kore_runtime_call *, #endif struct kore_domain *kore_domain_lookup(const char *); -struct kore_module_handle *kore_module_handler_find(const char *, - const char *); #if !defined(KORE_NO_HTTP) void kore_validator_init(void); diff --git a/src/domain.c b/src/domain.c @@ -189,7 +189,11 @@ kore_domain_new(char *domain) dom->x509_verify_depth = 1; #endif dom->domain = kore_strdup(domain); + +#if !defined(KORE_NO_HTTP) TAILQ_INIT(&(dom->handlers)); +#endif + TAILQ_INSERT_TAIL(&domains, dom, list); if (primary_dom == NULL) diff --git a/src/module.c b/src/module.c @@ -134,8 +134,10 @@ kore_module_reload(int cbs) { struct stat st; int ret; +#if !defined(KORE_NO_HTTP) struct kore_domain *dom; struct kore_module_handle *hdlr; +#endif struct kore_module *module; TAILQ_FOREACH(module, &modules, list) { @@ -182,6 +184,7 @@ kore_module_reload(int cbs) kore_log(LOG_NOTICE, "reloaded '%s' module", module->path); } +#if !defined(KORE_NO_HTTP) TAILQ_FOREACH(dom, &domains, list) { TAILQ_FOREACH(hdlr, &(dom->handlers), list) { kore_free(hdlr->rcall); @@ -191,6 +194,7 @@ kore_module_reload(int cbs) hdlr->errors = 0; } } +#endif #if !defined(KORE_NO_HTTP) kore_validator_reload(); diff --git a/src/worker.c b/src/worker.c @@ -484,6 +484,7 @@ kore_worker_wait(int final) u_int16_t id; pid_t pid; struct kore_worker *kw; + const char *func; int status; if (final) @@ -514,11 +515,14 @@ kore_worker_wait(int final) if (WEXITSTATUS(status) || WTERMSIG(status) || WCOREDUMP(status)) { + func = "none"; +#if !defined(KORE_NO_HTTP) + if (kw->active_hdlr != NULL) + func = kw->active_hdlr->func; +#endif kore_log(LOG_NOTICE, "worker %d (pid: %d) (hdlr: %s) gone", - kw->id, kw->pid, - (kw->active_hdlr != NULL) ? kw->active_hdlr->func : - "none"); + kw->id, kw->pid, func); #if !defined(KORE_NO_TLS) if (id == KORE_WORKER_KEYMGR) { @@ -536,6 +540,7 @@ kore_worker_wait(int final) worker_no_lock == 0) worker_unlock(); +#if !defined(KORE_NO_HTTP) if (kw->active_hdlr != NULL) { kw->active_hdlr->errors++; kore_log(LOG_NOTICE, @@ -543,6 +548,7 @@ kore_worker_wait(int final) kw->active_hdlr->func, kw->active_hdlr->errors); } +#endif kore_log(LOG_NOTICE, "restarting worker %d", kw->id); kw->restarted = 1;