struct buffer bi, bo; /* input and output buffers to send/recv check */
struct buffer_wait buf_wait; /* Wait list for buffer allocation */
struct task *task; /* the task associated to the health check processing, NULL if disabled */
- struct timeval start; /* last health check start time */
+ ullong start; /* last health check start time */
long duration; /* time in ms took to finish last health check */
short status, code; /* check result, check code */
unsigned short port; /* the port to use for the health checks */
if (status == HCHK_STATUS_START) {
check->result = CHK_RES_UNKNOWN; /* no result yet */
check->desc[0] = '\0';
- check->start = now;
+ check->start = tv_to_ns(&now);
return;
}
if (status == HCHK_STATUS_HANA)
check->duration = -1;
- else if (!tv_iszero(&check->start)) {
+ else if (check->start) {
/* set_server_check_status() may be called more than once */
- check->duration = ns_to_ms(tv_to_ns(&now) - tv_to_ns(&check->start));
- tv_zero(&check->start);
+ check->duration = ns_to_ms(tv_to_ns(&now) - check->start);
+ check->start = 0;
}
/* no change is expected if no state change occurred */
/* check this every ms */
t->expire = tick_add(now_ms, MS_TO_TICKS(mininter * srvpos / nbcheck));
- check->start = now;
+ check->start = tv_to_ns(&now);
task_queue(t);
return 1;