]> git.gsnw.org Git - fping.git/commitdiff
use last_send_time instead of current_time to schedule next events after a ping ...
authorDavid Schweikert <david@schweikert.ch>
Thu, 15 Dec 2011 17:10:25 +0000 (18:10 +0100)
committerDavid Schweikert <david@schweikert.ch>
Thu, 15 Dec 2011 17:10:25 +0000 (18:10 +0100)
fping.c

diff --git a/fping.c b/fping.c
index 90925d06e84e754ef69e7cac72a019a94de5f010..c5c5146b7484c9f503cd836efec3f78b54e9999c 100644 (file)
--- 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);
                 }