nap time between pats is forced to be at most half of the timeout

Previously, if the timeout was less than 10 seconds, for example, about
8 seconds, then the watchdog timer would be let to expire before patting
the watchdog.

MFC after:	2 weeks
This commit is contained in:
Andriy Gapon 2016-10-28 14:49:54 +00:00
parent 211029ce84
commit 9cb44c5d21
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308040

View File

@ -80,7 +80,8 @@ static u_int timeout = WD_TO_128SEC;
static u_int exit_timeout = WD_TO_NEVER;
static u_int pretimeout = 0;
static u_int timeout_sec;
static u_int passive = 0;
static u_int nap = 10;
static int passive = 0;
static int is_daemon = 0;
static int is_dry_run = 0; /* do not arm the watchdog, only
report on timing of the watch
@ -88,7 +89,6 @@ static int is_dry_run = 0; /* do not arm the watchdog, only
static int do_timedog = 0;
static int do_syslog = 1;
static int fd = -1;
static int nap = 10;
static int carp_thresh_seconds = -1;
static char *test_cmd = NULL;
@ -771,6 +771,9 @@ parseargs(int argc, char *argv[])
}
}
if (nap > timeout_sec / 2)
nap = timeout_sec / 2;
if (carp_thresh_seconds == -1)
carp_thresh_seconds = nap;