From: phk Date: Mon, 24 Sep 2007 12:27:54 +0000 (+0000) Subject: Make the cli_timeout a parameter. The master will wait this long X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d84d680db4165399fdf7521a340cd8c6538f708b;p=varnish Make the cli_timeout a parameter. The master will wait this long for the client to reply on the internal CLI pipe. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2009 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/heritage.h b/varnish-cache/bin/varnishd/heritage.h index b0e9f8a8..27902b6b 100644 --- a/varnish-cache/bin/varnishd/heritage.h +++ b/varnish-cache/bin/varnishd/heritage.h @@ -117,7 +117,8 @@ struct params { unsigned backend_http11; unsigned client_http11; - /* Ping interval */ + /* CLI related */ + unsigned cli_timeout; unsigned ping_interval; /* LRU list ordering interval */ diff --git a/varnish-cache/bin/varnishd/mgt_cli.c b/varnish-cache/bin/varnishd/mgt_cli.c index 4de8f5d9..8eb48064 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.c +++ b/varnish-cache/bin/varnishd/mgt_cli.c @@ -49,6 +49,7 @@ #include "cli.h" #include "vsb.h" #include "cli_common.h" +#include "heritage.h" #include "mgt.h" #include "mgt_cli.h" #include "mgt_event.h" @@ -126,7 +127,7 @@ mcf_passthru(struct cli *cli, char **av, void *priv) xxxassert(i == vsb_len(sb)); vsb_delete(sb); - i = cli_readres(cli_i, &u, &p, 3.0); + i = cli_readres(cli_i, &u, &p, params->cli_timeout); cli_result(cli, u); cli_out(cli, "%s", p); free(p); @@ -247,7 +248,7 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) return (CLIS_COMMS); } - i = cli_readres(cli_i, &u, resp, 5.0); + i = cli_readres(cli_i, &u, resp, params->cli_timeout); if (status != NULL) *status = u; return (u == CLIS_OK ? 0 : u); diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index b50556f6..c0cfeb7c 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -515,6 +515,15 @@ tweak_client_http11(struct cli *cli, struct parspec *par, const char *arg) /*--------------------------------------------------------------------*/ +static void +tweak_cli_timeout(struct cli *cli, struct parspec *par, const char *arg) +{ + (void)par; + tweak_generic_timeout(cli, &master.cli_timeout, arg); +} + +/*--------------------------------------------------------------------*/ + static void tweak_ping_interval(struct cli *cli, struct parspec *par, const char *arg) { @@ -719,6 +728,10 @@ static struct parspec parspec[] = { "backend response." EXPERIMENTAL, "off", "bool" }, + { "cli_timeout", tweak_cli_timeout, + "Timeout for the childs replies to CLI requests from " + "the master.\n", + "5", "seconds" }, { "ping_interval", tweak_ping_interval, "Interval between pings from parent to child.\n" "Zero will disable pinging entirely, which makes "