]> git.gsnw.org Git - fping.git/commitdiff
fix average when discarding reply in interval counting
authorDavid Schweikert <david@schweikert.ch>
Thu, 3 Nov 2016 08:21:27 +0000 (09:21 +0100)
committerDavid Schweikert <david@schweikert.ch>
Thu, 3 Nov 2016 08:21:27 +0000 (09:21 +0100)
src/fping.c

index e4ccc02d0f5dc5e41f5ffb5649182f2bc9f09338..c9a4981ee23d54e094bc825102af5004e87c259b 100644 (file)
@@ -1685,22 +1685,23 @@ int wait_for_reply(long wait_time)
         h->waiting = 0;
         h->timeout = timeout;
         h->num_recv++;
+
         if(h->discard_next_recv_i) {
             h->discard_next_recv_i=0;
         }
         else {
             h->num_recv_i++;
+            if( !h->max_reply_i || this_reply > h->max_reply_i ) h->max_reply_i = this_reply;
+            if( !h->min_reply_i || this_reply < h->min_reply_i ) h->min_reply_i = this_reply;
+            h->total_time_i += this_reply;
         }
 
         if( !max_reply      || this_reply > max_reply ) max_reply = this_reply;
         if( !min_reply      || this_reply < min_reply ) min_reply = this_reply;
         if( !h->max_reply   || this_reply > h->max_reply ) h->max_reply = this_reply;
         if( !h->min_reply   || this_reply < h->min_reply ) h->min_reply = this_reply;
-        if( !h->max_reply_i || this_reply > h->max_reply_i ) h->max_reply_i = this_reply;
-        if( !h->min_reply_i || this_reply < h->min_reply_i ) h->min_reply_i = this_reply;
         sum_replies += this_reply;
         h->total_time += this_reply;
-        h->total_time_i += this_reply;
         total_replies++;
     }