From 80122ac93002d5c07c9b02a8a6a12e5fd88067be Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Thu, 15 Dec 2011 18:10:25 +0100 Subject: [PATCH] use last_send_time instead of current_time to schedule next events after a ping (should be a bit more precise) --- fping.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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); }