Mailing List Archive

[master] 796a645b1 Move the initial cli-pipe handshake to mgt_cli.c
commit 796a645b1fd4ecff58205ed7409463aacb28c29d
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Wed Jan 24 08:33:53 2024 +0000

Move the initial cli-pipe handshake to mgt_cli.c

diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 3d133db34..5b22eb85c 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -89,7 +89,7 @@ void mgt_cli_setup(int fdi, int fdo, int auth, const char *ident,
mgt_cli_close_f *close_func, void *priv);
int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
v_printflike_(3, 4);
-void mgt_cli_start_child(int fdi, int fdo);
+unsigned mgt_cli_start_child(int fd, double tmo);
void mgt_cli_stop_child(void);
void mgt_cli_telnet(const char *T_arg);
void mgt_cli_master(const char *M_arg);
diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 697b05826..4ab09253c 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -430,7 +430,8 @@ mgt_launch_child(struct cli *cli)
bstart = mgt_param.startup_timeout >= mgt_param.cli_timeout;
dstart = bstart ? mgt_param.startup_timeout : mgt_param.cli_timeout;
t0 = VTIM_mono();
- if (VCLI_ReadResult(child_cli_fd, &u, NULL, dstart)) {
+ u = mgt_cli_start_child(child_cli_fd, dstart);
+ if (u != CLIS_OK) {
assert(u == CLIS_COMMS);
if (VTIM_mono() - t0 < dstart)
mgt_launch_err(cli, u, "Child failed on launch ");
@@ -470,7 +471,6 @@ mgt_launch_child(struct cli *cli)
ev_poker = e;
}

- mgt_cli_start_child(child_cli_fd, child_cli_fd);
child_pid = pid;

if (mgt_push_vcls(cli, &u, &p)) {
diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index c3cada3d9..6693af8c3 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -213,12 +213,17 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)

/*--------------------------------------------------------------------*/

-void
-mgt_cli_start_child(int fdi, int fdo)
+unsigned
+mgt_cli_start_child(int fd, double tmo)
{
+ unsigned u;

- cli_i = fdi;
- cli_o = fdo;
+ cli_i = fd;
+ cli_o = fd;
+ if (VCLI_ReadResult(cli_i, &u, NULL, tmo)) {
+ return (CLIS_COMMS);
+ }
+ return (u);
}

/*--------------------------------------------------------------------*/
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit