r678 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Sat Aug 5 18:41:12 CEST 2006
Author: phk
Date: 2006-08-05 18:41:11 +0200 (Sat, 05 Aug 2006)
New Revision: 678
Modified:
trunk/varnish-cache/bin/varnishd/mgt_child.c
Log:
Issue error message for CLI::start and CLI::stop if child is
not in a legal state for command.
Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:32:19 UTC (rev 677)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2006-08-05 16:41:11 UTC (rev 678)
@@ -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 @@
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 @@
(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]);
+ }
}
More information about the varnish-commit
mailing list