Commit a000522f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Parse hello-intervals as a number of seconds.

This is an incompatible change in the syntax of the config file.
parent 72f344f4
......@@ -129,6 +129,24 @@ getint(int c, int *int_r, gnc_t gnc, void *closure)
return c;
}
static int
getmsec(int c, int *int_r, gnc_t gnc, void *closure)
{
char *t;
int i;
c = getword(c, &t, gnc, closure);
if(c < -1)
return c;
i = parse_msec(t);
if(i < 0) {
free(t);
return -2;
}
free(t);
*int_r = i;
return c;
}
static int
getbool(int c, int *int_r, gnc_t gnc, void *closure)
{
......@@ -388,7 +406,7 @@ parse_nconf(gnc_t gnc, void *closure)
nconf->cost = cost;
} else if(strcmp(token, "hello-interval") == 0) {
int interval;
c = getint(c, &interval, gnc, closure);
c = getmsec(c, &interval, gnc, closure);
if(c < -1 || interval <= 0 || interval > 10 * 0xFFFF)
goto error;
nconf->hello_interval = interval;
......
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