diff options
author | Kozlov Dmitry <dima@server> | 2010-12-06 18:59:54 +0300 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-12-06 18:59:54 +0300 |
commit | f73cb9f4457c40edf787efcf30ea80822381a732 (patch) | |
tree | 059752a75e0fd4847c386db73ffd295065c82516 /accel-pptpd/ctrl/pptp | |
parent | deecc72f6a96153d93dccd547177676bc878a3f3 (diff) | |
download | accel-ppp-xebd-f73cb9f4457c40edf787efcf30ea80822381a732.tar.gz accel-ppp-xebd-f73cb9f4457c40edf787efcf30ea80822381a732.zip |
cli: implemented shutdown command to shutdown daemon
Diffstat (limited to 'accel-pptpd/ctrl/pptp')
-rw-r--r-- | accel-pptpd/ctrl/pptp/pptp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/accel-pptpd/ctrl/pptp/pptp.c b/accel-pptpd/ctrl/pptp/pptp.c index f7ffee0..887db37 100644 --- a/accel-pptpd/ctrl/pptp/pptp.c +++ b/accel-pptpd/ctrl/pptp/pptp.c @@ -56,6 +56,7 @@ static int conf_timeout = 5; static int conf_echo_interval = 0; static int conf_echo_failure = 3; static int conf_verbose = 0; +static int shutdown_soft; static mempool_t conn_pool; @@ -617,6 +618,11 @@ static int pptp_connect(struct triton_md_handler_t *h) continue; } + if (shutdown_soft) { + close(sock); + continue; + } + log_info2("pptp: new connection from %s\n", inet_ntoa(addr.sin_addr)); if (iprange_client_check(addr.sin_addr.s_addr)) { @@ -694,6 +700,11 @@ static int show_stat_exec(const char *cmd, char * const *fields, int fields_cnt, return CLI_CMD_OK; } +static void ev_shutdown_soft(void) +{ + shutdown_soft = 1; +} + static void __init pptp_init(void) { struct sockaddr_in addr; @@ -756,5 +767,7 @@ static void __init pptp_init(void) triton_context_wakeup(&serv.ctx); cli_register_simple_cmd2(show_stat_exec, NULL, 2, "show", "stat"); + + triton_event_register_handler(EV_SHUTDOWN_SOFT, (triton_event_func)ev_shutdown_soft); } |