Commit 0e13bdad authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Issue error message for CLI::start and CLI::stop if child is

not in a legal state for command.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@678 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent b3db092c
......@@ -21,6 +21,7 @@
#include "libvarnish.h"
#include "heritage.h"
#include "mgt.h"
#include "cli.h"
#include "cli_priv.h"
#include "mgt_cli.h"
#include "mgt_event.h"
......@@ -37,6 +38,14 @@ static enum {
CH_DIED = 4
} child_state = CH_STOPPED;
const char *ch_state[] = {
[CH_STOPPED] = "stopped",
[CH_STARTING] = "starting",
[CH_RUNNING] = "running",
[CH_STOPPING] = "stopping",
[CH_DIED] = "died, (restarting)",
};
struct evbase *mgt_evb;
struct ev *ev_poker;
struct ev *ev_listen;
......@@ -327,9 +336,12 @@ mcf_server_startstop(struct cli *cli, char **av, void *priv)
(void)cli;
(void)av;
if (priv != NULL) {
if (priv != NULL && child_state == CH_RUNNING)
stop_child();
return;
}
start_child();
else if (priv == NULL && child_state == CH_STOPPED)
start_child();
else {
cli_result(cli, CLIS_CANT);
cli_out(cli, "Child in state %s", ch_state[child_state]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment