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/cli/std_cmd.c | |
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/cli/std_cmd.c')
-rw-r--r-- | accel-pptpd/cli/std_cmd.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/accel-pptpd/cli/std_cmd.c b/accel-pptpd/cli/std_cmd.c index a5cfd38f..3563db95 100644 --- a/accel-pptpd/cli/std_cmd.c +++ b/accel-pptpd/cli/std_cmd.c @@ -450,11 +450,40 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli) return CLI_CMD_OK; } +//========================== +static int conf_reload_res; +static struct triton_context_t *conf_reload_ctx; +static void conf_reload_notify(int r) +{ + if (!r) + triton_event_fire(EV_CONFIG_RELOAD, NULL); + conf_reload_res = r; + triton_context_wakeup(conf_reload_ctx); +} +static int reload_exec(const char *cmd, char * const *f, int f_cnt, void *cli) +{ + if (f_cnt == 1) { + conf_reload_ctx = triton_context_self(); + triton_conf_reload(conf_reload_notify); + triton_context_schedule(); + if (conf_reload_res) + cli_send(cli, "failed\r\n"); + return CLI_CMD_OK; + } else + return CLI_CMD_SYNTAX; +} + +static void reload_help(char * const *fields, int fields_cnt, void *client) +{ + cli_send(client, "reload - reload config file\r\n"); +} + static void __init init(void) { cli_register_simple_cmd2(show_stat_exec, show_stat_help, 2, "show", "stat"); cli_register_simple_cmd2(show_ses_exec, show_ses_help, 2, "show", "sessions"); cli_register_simple_cmd2(terminate_exec, terminate_help, 1, "terminate"); + cli_register_simple_cmd2(reload_exec, reload_help, 1, "reload"); cli_register_simple_cmd2(shutdown_exec, shutdown_help, 1, "shutdown"); cli_register_simple_cmd2(exit_exec, exit_help, 1, "exit"); } |