summaryrefslogtreecommitdiff
path: root/accel-pppd/cli
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-03-18 19:37:19 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-03-18 19:37:19 +0300
commit65c90307db554663964f1aa2624630433a98d040 (patch)
tree5afe7c8ee96f188bc3c63e476b7e17ef839232c0 /accel-pppd/cli
parente7d6fe6a72d0e03b1c63d070ff6e2f187a40f02a (diff)
downloadaccel-ppp-65c90307db554663964f1aa2624630433a98d040.tar.gz
accel-ppp-65c90307db554663964f1aa2624630433a98d040.zip
improved restart and termination procedure
Diffstat (limited to 'accel-pppd/cli')
-rw-r--r--accel-pppd/cli/std_cmd.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c
index 2f5af8aa..62327f92 100644
--- a/accel-pppd/cli/std_cmd.c
+++ b/accel-pppd/cli/std_cmd.c
@@ -341,47 +341,40 @@ static void reload_help(char * const *fields, int fields_cnt, void *client)
//==========================
-static void __do_restart1(void)
-{
- core_restart(1);
-}
-
-static void __do_restart0(void)
-{
- core_restart(0);
-}
-
-
static int restart_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
{
- void (*restart)(void);
-
if (f_cnt == 2) {
+#ifdef USE_BACKUP
if (strcmp(f[1], "soft") == 0)
- restart = __do_restart1;
- else if (strcmp(f[1], "gracefully") == 0)
- restart = __do_restart0;
- else if (strcmp(f[1], "hard") == 0)
- core_restart(0);
+ core_restart(1);
else
+#endif
+ if (strcmp(f[1], "hard") == 0) {
+ terminate_all_sessions(1);
+ core_restart(0);
+ return CLI_CMD_OK;
+ } else
return CLI_CMD_SYNTAX;
} else if (f_cnt == 1)
- restart = __do_restart1;
+ core_restart(0);
else
return CLI_CMD_SYNTAX;
- ap_shutdown_soft(restart, 0);
- terminate_all_sessions(0);
+ core_restart(0);
return CLI_CMD_OK;
}
static void restart_help(char * const *fields, int fields_cnt, void *client)
{
- cli_send(client, "restart [soft|gracefully|hard] - restart daemon\r\n");
+#ifdef USE_BACKUP
+ cli_send(client, "restart [soft|hard] - restart daemon\r\n");
cli_send(client, "\t\tsoft - restart daemon softly, e.g. keep existing connections if session backup is enabled (default)\r\n");
- cli_send(client, "\t\tgracefully - terminate all connections then restart\r\n");
+#else
+ cli_send(client, "restart [hard] - restart daemon\r\n");
+#endif
cli_send(client, "\t\thard - restart immediatly\r\n");
+ cli_send(client, "\t\tdefault action - terminate all connections then restart\r\n");
}