forked from mirrors/kore
Remove kore_cb and its related settings.
After revisiting why this exists in Kore I decided it does not belong in this platform and instead of letting it sit there staring at me I rather just kill it.
This commit is contained in:
parent
b3f65ae13f
commit
4010bdd58d
|
@ -23,15 +23,6 @@ workers 4
|
|||
# Store the main process its pid in this file.
|
||||
#pidfile /var/run/kore.pid
|
||||
|
||||
# You can define a callback Kore calls from its parent process or
|
||||
# workers everytime the kore_cb_interval timer (in milliseconds) is reached.
|
||||
#
|
||||
# NOTE: Remember that the parent process runs as root and is not chroot().
|
||||
# NOTE: If you want the cb to run on a worker, be sure to set kore_cb_worker.
|
||||
#kore_cb my_callback
|
||||
#kore_cb_interval 1000
|
||||
#kore_cb_worker 3
|
||||
|
||||
# HTTP specific settings.
|
||||
# http_header_max Maximum size of HTTP headers (in bytes).
|
||||
#
|
||||
|
|
|
@ -308,21 +308,17 @@ extern char *chroot_path;
|
|||
extern char *runas_user;
|
||||
extern char *kore_pidfile;
|
||||
extern char *config_file;
|
||||
extern char *kore_cb_name;
|
||||
extern char *kore_ssl_cipher_list;
|
||||
extern DH *ssl_dhparam;
|
||||
extern int ssl_no_compression;
|
||||
extern int kore_cb_worker;
|
||||
|
||||
extern u_int8_t nlisteners;
|
||||
extern u_int64_t spdy_idle_time;
|
||||
extern u_int16_t cpu_count;
|
||||
extern u_int8_t worker_count;
|
||||
extern u_int64_t kore_cb_interval;
|
||||
extern u_int32_t worker_rlimit_nofiles;
|
||||
extern u_int32_t worker_max_connections;
|
||||
extern u_int32_t worker_active_connections;
|
||||
extern void (*kore_cb)(void);
|
||||
|
||||
extern struct listener_head listeners;
|
||||
extern struct kore_worker *worker;
|
||||
|
|
67
src/config.c
67
src/config.c
|
@ -48,9 +48,6 @@ static int configure_ssl_cipher(char **);
|
|||
static int configure_ssl_dhparam(char **);
|
||||
static int configure_ssl_no_compression(char **);
|
||||
static int configure_spdy_idle_time(char **);
|
||||
static int configure_kore_cb(char **);
|
||||
static int configure_kore_cb_interval(char **);
|
||||
static int configure_kore_cb_worker(char **);
|
||||
static int configure_http_header_max(char **);
|
||||
static int configure_http_postbody_max(char **);
|
||||
static int configure_http_hsts_enable(char **);
|
||||
|
@ -96,9 +93,6 @@ static struct {
|
|||
{ "certfile", configure_certfile },
|
||||
{ "certkey", configure_certkey },
|
||||
{ "require_client_cert", configure_require_client_cert },
|
||||
{ "kore_cb", configure_kore_cb },
|
||||
{ "kore_cb_worker", configure_kore_cb_worker },
|
||||
{ "kore_cb_interval", configure_kore_cb_interval },
|
||||
{ "http_header_max", configure_http_header_max },
|
||||
{ "http_postbody_max", configure_http_postbody_max },
|
||||
{ "http_hsts_enable", configure_http_hsts_enable },
|
||||
|
@ -132,8 +126,6 @@ kore_parse_config(void)
|
|||
|
||||
if (!kore_module_loaded())
|
||||
fatal("no site module was loaded");
|
||||
if (kore_cb_name != NULL && kore_cb == NULL)
|
||||
fatal("no '%s' symbol found for kore_cb", kore_cb_name);
|
||||
|
||||
if (LIST_EMPTY(&listeners))
|
||||
fatal("no listeners defined");
|
||||
|
@ -570,65 +562,6 @@ configure_rlimit_nofiles(char **argv)
|
|||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_kore_cb(char **argv)
|
||||
{
|
||||
if (argv[1] == NULL)
|
||||
return (KORE_RESULT_ERROR);
|
||||
|
||||
if (kore_cb_name != NULL) {
|
||||
kore_debug("kore_cb was already set");
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
kore_cb_name = kore_strdup(argv[1]);
|
||||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_kore_cb_interval(char **argv)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (argv[1] == NULL)
|
||||
return (KORE_RESULT_ERROR);
|
||||
|
||||
if (kore_cb_interval != 0) {
|
||||
kore_debug("kore_cb_interval already given");
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
kore_cb_interval = kore_strtonum(argv[1], 10, 1, LLONG_MAX, &err);
|
||||
if (err != KORE_RESULT_OK) {
|
||||
printf("invalid value for kore_cb_interval: %s\n", argv[1]);
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_kore_cb_worker(char **argv)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (argv[1] == NULL)
|
||||
return (KORE_RESULT_ERROR);
|
||||
|
||||
if (kore_cb_worker != -1) {
|
||||
kore_debug("kore_cb_worker already set");
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
kore_cb_worker = kore_strtonum(argv[1], 10, 0, worker_count, &err);
|
||||
if (err != KORE_RESULT_OK) {
|
||||
printf("invalid value for kore_cb_worker: %s\n", argv[1]);
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
return (KORE_RESULT_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
configure_http_header_max(char **argv)
|
||||
{
|
||||
|
|
15
src/kore.c
15
src/kore.c
|
@ -34,9 +34,6 @@ int skip_chroot = 0;
|
|||
u_int8_t worker_count = 0;
|
||||
char *runas_user = NULL;
|
||||
char *chroot_path = NULL;
|
||||
int kore_cb_worker = -1;
|
||||
u_int64_t kore_cb_interval = 0;
|
||||
void (*kore_cb)(void) = NULL;
|
||||
char *kore_pidfile = KORE_PIDFILE_DEFAULT;
|
||||
char *kore_ssl_cipher_list = KORE_DEFAULT_CIPHER_LIST;
|
||||
|
||||
|
@ -298,7 +295,6 @@ static void
|
|||
kore_server_start(void)
|
||||
{
|
||||
int quit;
|
||||
u_int64_t now, last_cb_run;
|
||||
|
||||
kore_mem_free(runas_user);
|
||||
|
||||
|
@ -321,9 +317,6 @@ kore_server_start(void)
|
|||
kore_worker_init();
|
||||
|
||||
quit = 0;
|
||||
now = kore_time_ms();
|
||||
last_cb_run = now;
|
||||
|
||||
while (quit != 1) {
|
||||
if (sig_recv != 0) {
|
||||
switch (sig_recv) {
|
||||
|
@ -348,14 +341,6 @@ kore_server_start(void)
|
|||
if (!kore_accesslog_wait())
|
||||
break;
|
||||
|
||||
if (kore_cb != NULL && kore_cb_worker == -1) {
|
||||
now = kore_time_ms();
|
||||
if ((now - last_cb_run) >= kore_cb_interval) {
|
||||
kore_cb();
|
||||
last_cb_run = now;
|
||||
}
|
||||
}
|
||||
|
||||
kore_worker_wait(0);
|
||||
}
|
||||
}
|
||||
|
|
12
src/module.c
12
src/module.c
|
@ -21,7 +21,6 @@
|
|||
#include "kore.h"
|
||||
|
||||
static TAILQ_HEAD(, kore_module) modules;
|
||||
char *kore_cb_name = NULL;
|
||||
|
||||
void
|
||||
kore_module_init(void)
|
||||
|
@ -58,9 +57,6 @@ kore_module_load(const char *path, const char *onload)
|
|||
fatal("%s: onload '%s' not present", path, onload);
|
||||
}
|
||||
|
||||
if (kore_cb_name != NULL && kore_cb == NULL)
|
||||
kore_cb = dlsym(module->handle, kore_cb_name);
|
||||
|
||||
TAILQ_INSERT_TAIL(&modules, module, list);
|
||||
}
|
||||
|
||||
|
@ -85,8 +81,6 @@ kore_module_reload(int cbs)
|
|||
struct kore_module_handle *hdlr;
|
||||
struct kore_module *module;
|
||||
|
||||
kore_cb = NULL;
|
||||
|
||||
TAILQ_FOREACH(module, &modules, list) {
|
||||
if (stat(module->path, &st) == -1) {
|
||||
kore_log(LOG_NOTICE, "stat(%s): %s, skipping reload",
|
||||
|
@ -119,15 +113,9 @@ kore_module_reload(int cbs)
|
|||
module->ocb(KORE_MODULE_LOAD);
|
||||
}
|
||||
|
||||
if (kore_cb_name != NULL && kore_cb == NULL)
|
||||
kore_cb = dlsym(module->handle, kore_cb_name);
|
||||
|
||||
kore_log(LOG_NOTICE, "reloaded '%s' module", module->path);
|
||||
}
|
||||
|
||||
if (kore_cb_name != NULL && kore_cb == NULL)
|
||||
fatal("no kore_cb %s found in loaded modules", kore_cb_name);
|
||||
|
||||
TAILQ_FOREACH(dom, &domains, list) {
|
||||
TAILQ_FOREACH(hdlr, &(dom->handlers), list) {
|
||||
hdlr->addr = kore_module_getsym(hdlr->func);
|
||||
|
|
11
src/worker.c
11
src/worker.c
|
@ -180,7 +180,7 @@ kore_worker_entry(struct kore_worker *kw)
|
|||
char buf[16];
|
||||
struct connection *c, *cnext;
|
||||
int quit, had_lock;
|
||||
u_int64_t now, idle_check, last_cb_run, timer;
|
||||
u_int64_t now, idle_check, timer;
|
||||
|
||||
worker = kw;
|
||||
|
||||
|
@ -237,7 +237,6 @@ kore_worker_entry(struct kore_worker *kw)
|
|||
now = idle_check = 0;
|
||||
kore_platform_event_init();
|
||||
kore_accesslog_worker_init();
|
||||
last_cb_run = kore_time_ms();
|
||||
|
||||
#if defined(KORE_USE_PGSQL)
|
||||
kore_pgsql_init();
|
||||
|
@ -296,14 +295,6 @@ kore_worker_entry(struct kore_worker *kw)
|
|||
}
|
||||
}
|
||||
|
||||
if (kore_cb != NULL && kore_cb_worker != -1 &&
|
||||
kore_cb_worker == worker->id) {
|
||||
if ((now - last_cb_run) >= kore_cb_interval) {
|
||||
kore_cb();
|
||||
last_cb_run = now;
|
||||
}
|
||||
}
|
||||
|
||||
for (c = TAILQ_FIRST(&disconnected); c != NULL; c = cnext) {
|
||||
cnext = TAILQ_NEXT(c, list);
|
||||
TAILQ_REMOVE(&disconnected, c, list);
|
||||
|
|
Loading…
Reference in New Issue