varnishadm: use the -t argument as the timeout

We used the -t argument only for the VSM attach, not for the actual CLI
operations.

I do not think the complication of differentiated timeouts is justified,
so just use the one timeout parameter we have for both. Also I think
that the documentation is already adequate in its simplicity:

       -t timeout
              Wait no longer than this many seconds for an operation to
              finish.

Fixes #3542
parent cf9548ef
......@@ -74,7 +74,7 @@
} while (0)
static const double timeout = 5; // XXX should be settable by arg ?
static double timeout = 5;
static int p_arg = 0;
static void
......@@ -423,6 +423,21 @@ n_arg_sock(const char *n_arg, const char *t_arg)
return (sock);
}
static int
t_arg_timeout(const char *t_arg)
{
char *p = NULL;
AN(t_arg);
timeout = strtod(t_arg, &p);
if ((p != NULL && *p != '\0') ||
!isfinite(timeout) || timeout < 0) {
fprintf(stderr, "-t: Invalid argument: %s", t_arg);
return (-1);
}
return (1);
}
#define OPTARG "hn:pS:T:t:"
int
......@@ -486,6 +501,9 @@ main(int argc, char * const *argv)
if (sock < 0)
exit(2);
if (t_arg != NULL && t_arg_timeout(t_arg) < 0)
exit(2);
if (argc > 0) {
VSIG_Arm_int();
VSIG_Arm_term();
......
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