don't consider duplicate pings as successful replies (#53)

pull/67/head
David Schweikert 11 years ago
parent a2ac5d0fae
commit 5c68d6f338

@ -217,10 +217,12 @@ typedef struct host_entry
unsigned char waiting; /* waiting for response */
struct timeval last_send_time; /* time of last packet sent */
int num_sent; /* number of ping packets sent */
int num_recv; /* number of pings received */
int num_recv; /* number of pings received (duplicates ignored) */
int num_recv_total; /* number of pings received, including duplicates */
int max_reply; /* longest response time */
int min_reply; /* shortest response time */
int total_time; /* sum of response times */
/* _i -> splits (reset on every report interval) */
int num_sent_i; /* number of ping packets sent */
int num_recv_i; /* number of pings received */
int max_reply_i; /* longest response time */
@ -1597,22 +1599,18 @@ int wait_for_reply(long wait_time)
n = seqmap_value->host_nr;
h = table[n];
sent_time = &seqmap_value->ping_ts;
this_count = seqmap_value->ping_count;
this_reply = timeval_diff( &current_time, sent_time );
/* received ping is cool, so process it */
if( h->resp_times[this_count] == RESP_WAITING )
{
/* only for non-duplicates: */
h->waiting = 0;
h->timeout = timeout;
h->num_recv++;
h->num_recv_i++;
sent_time = &seqmap_value->ping_ts;
this_count = seqmap_value->ping_count;
#if defined( DEBUG ) || defined( _DEBUG )
if( trace_flag )
printf( "received [%d] from %s\n", this_count, h->host );
#endif /* DEBUG || _DEBUG */
this_reply = timeval_diff( &current_time, sent_time );
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;
@ -1623,6 +1621,15 @@ int wait_for_reply(long wait_time)
h->total_time += this_reply;
h->total_time_i += this_reply;
total_replies++;
}
/* received ping is cool, so process it */
h->num_recv_total++;
#if defined( DEBUG ) || defined( _DEBUG )
if( trace_flag )
printf( "received [%d] from %s\n", this_count, h->host );
#endif /* DEBUG || _DEBUG */
/* note reply time in array, probably */
if( !loop_flag )
@ -1713,7 +1720,7 @@ int wait_for_reply(long wait_time)
else
{
printf( "%d%% return)",
( h->num_recv * 100 ) / h->num_sent );
( h->num_recv_total * 100 ) / h->num_sent );
}/* ELSE */
#ifndef IPV6

Loading…
Cancel
Save