Merge pull request #151 from brownowski/duplicate-patch-1

Only increase num_alive if response is not a duplicate
pull/186/head
David Schweikert 5 years ago committed by GitHub
commit f5f9415651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2208,6 +2208,27 @@ int wait_for_reply(long wait_time)
sum_replies += this_reply;
h->total_time += this_reply;
total_replies++;
if (h->num_recv == 1) {
num_alive++;
if (verbose_flag || alive_flag) {
printf("%s", h->host);
if (verbose_flag)
printf(" is alive");
if (elapsed_flag)
printf(" (%s ms)", sprint_tm(this_reply));
if (addr_cmp((struct sockaddr*)&response_addr, (struct sockaddr*)&h->saddr)) {
char buf[INET6_ADDRSTRLEN];
getnameinfo((struct sockaddr*)&response_addr, sizeof(response_addr), buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
fprintf(stderr, " [<- %s]", buf);
}
printf("\n");
}
}
}
/* received ping is cool, so process it */
@ -2244,27 +2265,6 @@ int wait_for_reply(long wait_time)
}
}
if (h->num_recv == 1) {
num_alive++;
if (verbose_flag || alive_flag) {
printf("%s", h->host);
if (verbose_flag)
printf(" is alive");
if (elapsed_flag)
printf(" (%s ms)", sprint_tm(this_reply));
if (addr_cmp((struct sockaddr*)&response_addr, (struct sockaddr*)&h->saddr)) {
char buf[INET6_ADDRSTRLEN];
getnameinfo((struct sockaddr*)&response_addr, sizeof(response_addr), buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
fprintf(stderr, " [<- %s]", buf);
}
printf("\n");
}
}
if (per_recv_flag) {
if (timestamp_flag) {
printf("[%lu.%06lu] ",

Loading…
Cancel
Save