From: David Schweikert Date: Thu, 15 Dec 2011 17:10:25 +0000 (+0100) Subject: use last_send_time instead of current_time to schedule next events after a ping ... X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80122ac93002d5c07c9b02a8a6a12e5fd88067be;p=fping.git use last_send_time instead of current_time to schedule next events after a ping (should be a bit more precise) --- diff --git a/fping.c b/fping.c index 90925d0..c5c5146 100644 --- a/fping.c +++ b/fping.c @@ -1141,8 +1141,8 @@ void main_loop() /* Normal mode: schedule retry */ if(h->waiting < retry + 1) { h->ev_type = EV_TYPE_PING; - h->ev_time.tv_sec = current_time.tv_sec; - h->ev_time.tv_usec = current_time.tv_usec; + h->ev_time.tv_sec = last_send_time.tv_sec; + h->ev_time.tv_usec = last_send_time.tv_usec; timeval_add(&h->ev_time, h->timeout); ev_enqueue(h); @@ -1153,8 +1153,8 @@ void main_loop() /* Normal mode: schedule timeout for last retry */ else { h->ev_type = EV_TYPE_TIMEOUT; - h->ev_time.tv_sec = current_time.tv_sec; - h->ev_time.tv_usec = current_time.tv_usec; + h->ev_time.tv_sec = last_send_time.tv_sec; + h->ev_time.tv_usec = last_send_time.tv_usec; timeval_add(&h->ev_time, h->timeout); ev_enqueue(h); } @@ -1163,16 +1163,16 @@ void main_loop() else if(loop_flag || (count_flag && h->num_sent < count)) { h->ev_type = EV_TYPE_PING; - h->ev_time.tv_sec = current_time.tv_sec; - h->ev_time.tv_usec = current_time.tv_usec; + h->ev_time.tv_sec = last_send_time.tv_sec; + h->ev_time.tv_usec = last_send_time.tv_usec; timeval_add(&h->ev_time, perhost_interval); ev_enqueue(h); } /* Count mode: schedule timeout after last ping */ else if(count_flag && count_flag && h->num_sent >= count) { h->ev_type = EV_TYPE_TIMEOUT; - h->ev_time.tv_sec = current_time.tv_sec; - h->ev_time.tv_usec = current_time.tv_usec; + h->ev_time.tv_sec = last_send_time.tv_sec; + h->ev_time.tv_usec = last_send_time.tv_usec; timeval_add(&h->ev_time, h->timeout); ev_enqueue(h); }