From b4190f07a8a91ede950fa890a8352ebf70bbf637 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 15 Jun 2011 22:15:19 +0200 Subject: Don't crash if ping fails --- bin/ekgping | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin/ekgping') diff --git a/bin/ekgping b/bin/ekgping index f3e1631..a7dffd1 100755 --- a/bin/ekgping +++ b/bin/ekgping @@ -92,7 +92,12 @@ print "\e[?25l"; while ( usleep(100_000) ) { - $ping->pump_nb(); + if ($ping->pumpable()) { + $ping->pump_nb(); + } + elsif (($dead_count % 10) == 0) + $ping->start(); + } $column++; @@ -220,8 +225,6 @@ B parses the output of ping(1), which means it assumes a certain output style. It will only work with ping(1) programs whose C<< ping -n >> output matches " bytes from : icmp_req= ttl= time=". -If a host is unreachable from the very beginning, B fails to start. - =head1 AUTHOR Copyright (C) 2011 by Daniel Friesel Ederf@finalrewind.orgE -- cgit v1.2.3