add ttl error when verbose is active
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
|
||||
/* Updated: 2025/06/01 22:09:27 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/06/02 22:10:42 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -60,7 +60,8 @@ void ping_end_print(t_settings *set, char *host, t_stats *stats)
|
||||
printf("--- %s ping statistics ---\n", host);
|
||||
percent = ((double)(stats->sent - stats->received) / stats->sent) * 100.0;
|
||||
printf("%lu packets transmitted, %lu packets received, %d%% packet loss\n", stats->sent, stats->received, percent);
|
||||
printf("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n", stats->min, stats->avg, stats->max, stddev);
|
||||
if(stats->received)
|
||||
printf("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n", stats->min, stats->avg, stats->max, stddev);
|
||||
}
|
||||
|
||||
int ping_host(t_settings *set, char *host)
|
||||
@ -88,10 +89,10 @@ int ping_host(t_settings *set, char *host)
|
||||
if(tmp)
|
||||
waitlist_add(&wl, tmp);
|
||||
usleep(100);
|
||||
receive_icmp(set, info, &wl, &stats);
|
||||
receive_icmp(set, &wl, &stats);
|
||||
}
|
||||
while(wl && !g_stop && timediff(&set->last_send_time) < set->linger)
|
||||
receive_icmp(set, info, &wl, &stats);
|
||||
receive_icmp(set, &wl, &stats);
|
||||
ping_end_print(set, host, &stats);
|
||||
freeaddrinfo(info);
|
||||
waitlist_free(wl);
|
||||
|
Reference in New Issue
Block a user