Commit 726b7926 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Add -t VSM open timeout option

This option controls the timeout for the initial VSM open operation
parent 3bfcf8b3
......@@ -43,6 +43,7 @@ struct VUT {
char *P_arg;
char *q_arg;
char *r_arg;
double t_arg;
/* State */
struct VSL_data *vsl;
......
......@@ -84,6 +84,18 @@
"Read log in binary file format from this file." \
)
#define VUT_OPT_t \
VOPT("t:", "[-t seconds|<off>]", "VSM connection timeout", \
"Timeout before returning error on initial VSM connection." \
" If set the VSM connection is retried every 0.5 seconds" \
" for this many seconds. If zero the connection is" \
" attempted only once and will fail immediately if" \
" unsuccessful. If set to \"off\", the connection will not" \
" fail, allowing the utility to start and wait" \
" indefinetely for the Varnish instance to appear. " \
" Defaults to 5 seconds." \
)
#define VUT_OPT_V \
VOPT("V", "[-V]", "Version", \
"Print version information and exit." \
......
......@@ -39,6 +39,7 @@
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <math.h>
#include "compat/daemon.h"
#include "vdef.h"
......@@ -49,6 +50,7 @@
#include "vas.h"
#include "miniobj.h"
#include "vcs.h"
#include "vnum.h"
#include "vut.h"
......@@ -134,6 +136,7 @@ VUT_Arg(int opt, const char *arg)
{
int i;
char *p;
double d;
switch (opt) {
case 'd':
......@@ -182,6 +185,13 @@ VUT_Arg(int opt, const char *arg)
/* Binary file input */
REPLACE(VUT.r_arg, arg);
return (1);
case 't':
/* VSM connect timeout */
d = VNUM(arg);
if (isnan(d))
VUT_Error(1, "-t: Syntax error");
VUT.t_arg = d;
return (1);
case 'V':
/* Print version number and exit */
VCS_Message(VUT.progname);
......@@ -205,6 +215,7 @@ VUT_Init(const char *progname)
VUT.vsl = VSL_New();
AN(VUT.vsl);
VUT.k_arg = -1;
VUT.t_arg = 5.;
}
void
......
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