b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] batctl: ping: Skip sleep after last packet
@ 2022-04-22  9:14 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2022-04-22  9:14 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Roman Le bg

The -i option for ping is documented as interval between ping requests. But
the sleep was also applied after all the requested pings already sent out.
As result, the user had to wait additional time until the statistics for
the (limited) ping test was printed.

Just skip the last sleep in case there will be no next ping packet to avoid
this problem.

Reported-by: Roman Le bg <roman@romanlebg.fr>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
 ping.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ping.c b/ping.c
index 7565dcd..3681e7e 100644
--- a/ping.c
+++ b/ping.c
@@ -282,6 +282,10 @@ static int ping(struct state *state, int argc, char **argv)
+		/* skip last sleep in case no more packets will be sent out */
+		if (loop_count == 0)
+			continue;
 		if (loop_interval > 0)
 		else if ((tv.tv_sec != 0) || (tv.tv_usec != 0))

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-22  9:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22  9:14 [PATCH] batctl: ping: Skip sleep after last packet Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).