diff options
| author | Kozlov Dmitry <dima@server> | 2010-12-27 15:25:38 +0300 |
|---|---|---|
| committer | Kozlov Dmitry <dima@server> | 2010-12-27 15:25:38 +0300 |
| commit | 2b34d862111f1fd84cdb9d744ac34c1c933f34da (patch) | |
| tree | 1e758ddc96689793e1c4c1b55cf3671bb05f2884 /accel-pptpd/ctrl/pptp | |
| parent | ccaeb500e38d82c37568292d7850b66691793626 (diff) | |
| download | accel-ppp-2b34d862111f1fd84cdb9d744ac34c1c933f34da.tar.gz accel-ppp-2b34d862111f1fd84cdb9d744ac34c1c933f34da.zip | |
implemented partial config reload via SIGUSR1 signal or cli
Diffstat (limited to 'accel-pptpd/ctrl/pptp')
| -rw-r--r-- | accel-pptpd/ctrl/pptp/pptp.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/accel-pptpd/ctrl/pptp/pptp.c b/accel-pptpd/ctrl/pptp/pptp.c index 0b92474..687aecb 100644 --- a/accel-pptpd/ctrl/pptp/pptp.c +++ b/accel-pptpd/ctrl/pptp/pptp.c @@ -700,6 +700,27 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, return CLI_CMD_OK; } +static void load_config(void) +{ + char *opt; + + opt = conf_get_opt("pptp", "timeout"); + if (opt && atoi(opt) > 0) + conf_timeout = atoi(opt); + + opt = conf_get_opt("pptp", "echo-interval"); + if (opt && atoi(opt) >= 0) + conf_echo_interval = atoi(opt); + + opt = conf_get_opt("pptp", "echo-failure"); + if (opt && atoi(opt) > 0) + conf_echo_failure = atoi(opt); + + opt = conf_get_opt("pptp", "verbose"); + if (opt && atoi(opt) > 0) + conf_verbose = 1; +} + static void __init pptp_init(void) { struct sockaddr_in addr; @@ -738,29 +759,17 @@ static void __init pptp_init(void) return; } - opt = conf_get_opt("pptp", "timeout"); - if (opt && atoi(opt) > 0) - conf_timeout = atoi(opt); - - opt = conf_get_opt("pptp", "echo-interval"); - if (opt && atoi(opt) >= 0) - conf_echo_interval = atoi(opt); - - opt = conf_get_opt("pptp", "echo-failure"); - if (opt && atoi(opt) > 0) - conf_echo_failure = atoi(opt); - - opt = conf_get_opt("pptp", "verbose"); - if (opt && atoi(opt) > 0) - conf_verbose = 1; - conn_pool = mempool_create(sizeof(struct pptp_conn_t)); + load_config(); + triton_context_register(&serv.ctx, NULL); triton_md_register_handler(&serv.ctx, &serv.hnd); triton_md_enable_handler(&serv.hnd, MD_MODE_READ); triton_context_wakeup(&serv.ctx); cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat"); + + triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config); } |
