From 6f6e41477b396bb3993fa8c1bef737fb7658cec3 Mon Sep 17 00:00:00 2001 From: tomoron Date: Sun, 24 Aug 2025 19:56:09 +0200 Subject: [PATCH] infinite interval when under 0 --- srcs/icmp.c | 4 ++-- srcs/parsing.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/srcs/icmp.c b/srcs/icmp.c index 3ae4839..745c6fc 100644 --- a/srcs/icmp.c +++ b/srcs/icmp.c @@ -6,7 +6,7 @@ /* By: tomoron +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/24 22:49:22 by tomoron #+# #+# */ -/* Updated: 2025/08/24 17:08:44 by tomoron ### ########.fr */ +/* Updated: 2025/08/24 19:55:45 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "includes/ft_ping.h" @@ -69,7 +69,7 @@ t_waitlist *send_icmp(t_settings *set, struct addrinfo *host, uint16_t *seq, t_s t_waitlist *ret; size_t len; - if(timediff(&set->last_send_time) < set->interval) + if(timediff(&set->last_send_time) < set->interval || (set->interval < 0 && stats->sent)) return (0); gettimeofday(&set->last_send_time, 0); packet = prepare_icmp_echo(*seq, set->id); diff --git a/srcs/parsing.c b/srcs/parsing.c index 0a30009..8713f5d 100644 --- a/srcs/parsing.c +++ b/srcs/parsing.c @@ -6,7 +6,7 @@ /* By: tomoron +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/26 17:01:53 by tomoron #+# #+# */ -/* Updated: 2025/08/24 16:43:35 by tomoron ### ########.fr */ +/* Updated: 2025/08/24 19:53:30 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "includes/ft_ping.h" @@ -69,7 +69,7 @@ int check_values(t_settings *set, char *name) return(0); } } - if (set->interval < 0.2) + if (set->interval < 0.2 && set->interval >= 0) { fprintf(stderr, "%s: option value is too small: %g\n", name, set->interval); return(0);