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/l2tp/l2tp.c | |
parent | deecc72f6a96153d93dccd547177676bc878a3f3 (diff) | |
download | accel-ppp-f73cb9f4457c40edf787efcf30ea80822381a732.tar.gz accel-ppp-f73cb9f4457c40edf787efcf30ea80822381a732.zip |
cli: implemented shutdown command to shutdown daemon
Diffstat (limited to 'accel-pptpd/ctrl/l2tp/l2tp.c')
-rw-r--r-- | accel-pptpd/ctrl/l2tp/l2tp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/accel-pptpd/ctrl/l2tp/l2tp.c b/accel-pptpd/ctrl/l2tp/l2tp.c index cb891b6e..2a48aa11 100644 --- a/accel-pptpd/ctrl/l2tp/l2tp.c +++ b/accel-pptpd/ctrl/l2tp/l2tp.c @@ -50,6 +50,8 @@ int conf_retransmit = 5; int conf_hello_interval = 60; const char *conf_host_name = "accel-pptp"; +static int shutdown_soft; + static uint32_t stat_active; static uint32_t stat_starting; @@ -638,6 +640,9 @@ static int l2tp_recv_SCCRQ(struct l2tp_serv_t *serv, struct l2tp_packet_t *pack) struct l2tp_attr_t *framing_cap = NULL; struct l2tp_attr_t *router_id = NULL; + if (shutdown_soft) + return 0; + list_for_each_entry(attr, &pack->attrs, entry) { switch (attr->attr->id) { case Protocol_Version: @@ -1107,6 +1112,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 l2tp_init(void) { char *opt; @@ -1143,5 +1153,7 @@ static void __init l2tp_init(void) start_udp_server(); cli_register_simple_cmd2(&show_stat_exec, NULL, 2, "show", "stat"); + + triton_event_register_handler(EV_SHUTDOWN_SOFT, (triton_event_func)ev_shutdown_soft); } |