[master] 055f33d Start the worker (after -I processing) if we have a VCL and are not in -d mode.
Poul-Henning Kamp
phk at FreeBSD.org
Sun Mar 12 23:11:05 CET 2017
commit 055f33d743fbbb9a416eb233f74b0387c4b2e49a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Sun Mar 12 21:41:52 2017 +0000
Start the worker (after -I processing) if we have a VCL and are not in -d mode.
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 02c58fe..f38ddd6 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -53,9 +53,10 @@ void MAC_Arg(const char *);
void MAC_reopen_sockets(struct cli *);
/* mgt_child.c */
-int MCH_Init(int launch);
+void MCH_Init(void);
int MCH_Running(void);
void MCH_Stop_Child(void);
+int MCH_Start_Child(void);
void MCH_TrackHighFd(int fd);
void MCH_Cli_Fail(void);
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 8a6acf7..338ca53 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -597,6 +597,18 @@ MCH_Stop_Child(void)
mgt_reap_child();
}
+/*=====================================================================
+ */
+
+int
+MCH_Start_Child(void)
+{
+ mgt_launch_child(NULL);
+ if (child_state != CH_RUNNING)
+ return (2);
+ return(0);
+}
+
/*====================================================================
* Query if the child is running
*/
@@ -668,17 +680,9 @@ static struct cli_proto cli_mch[] = {
* and to reincarnate it in case of trouble.
*/
-int
-MCH_Init(int launch)
+void
+MCH_Init(void)
{
VCLS_AddFunc(mgt_cls, MCF_AUTH, cli_mch);
-
- if (launch) {
- mgt_launch_child(NULL);
- if (child_state != CH_RUNNING)
- return (2);
- }
-
- return(0);
}
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 79bb3ed..cf8dbd9 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -862,9 +862,6 @@ main(int argc, char * const *argv)
mgt_SHM_Create();
- if (!d_flag && !mgt_has_vcl() && !novcl)
- MGT_Complain(C_ERR, "No VCL loaded yet");
-
memset(&sac, 0, sizeof sac);
sac.sa_handler = SIG_IGN;
sac.sa_flags = SA_RESTART;
@@ -872,7 +869,7 @@ main(int argc, char * const *argv)
AZ(sigaction(SIGPIPE, &sac, NULL));
AZ(sigaction(SIGHUP, &sac, NULL));
- u = MCH_Init(d_flag || novcl ? 0 : 1);
+ MCH_Init();
if (I_fd >= 0) {
fprintf(stderr, "BEGIN of -I file processing\n");
@@ -885,6 +882,14 @@ main(int argc, char * const *argv)
}
}
+ if (!d_flag && !mgt_has_vcl() && !novcl)
+ MGT_Complain(C_ERR, "No VCL loaded yet");
+
+ if (mgt_has_vcl() && ! d_flag)
+ u = MCH_Start_Child();
+ else
+ u = 0;
+
if (eric_fd >= 0)
mgt_eric_im_done(eric_fd, u);
More information about the varnish-commit
mailing list