wait a little bit before doing the second ping in Lib::CheckHostAlive to avoid pings spuriously failing

Peter Ross <[email protected]>
Newsgroups gmane.comp.sysutils.backup.backuppc.devel
Message-ID <[email protected]>
Hi,

On a system I am trying to backup (winxp running some unknown
firewall) I get weird behaviour;

sysman@vpil-bashful:~$ ping -c 1 pascal2; ping -c 1 pascal2
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.
64 bytes from pascal2.missioncriticalit.com (10.10.10.76): icmp_seq=1
ttl=128 time=0.172 ms

--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.172/0.172/0.172/0.000 ms
PING pascal2.missioncriticalit.com (10.10.10.76) 56(84) bytes of data.

--- pascal2.missioncriticalit.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

As you can see the first ping succeeds but the second fails.  As this
is what happens in Lib::CheckHostAlive it incorrectly marks the ping
as failing.

I applied the following patch to make it work.  One simply sleeps for
one second before doing the second ping, in which case it succeeds.

Regards,
Peter

--- Lib.pm	2009-10-06 22:16:42.000000000 +0200
+++ Lib.pm.new	2009-10-06 22:17:50.000000000 +0200
@@ -963,6 +963,12 @@
     }

     #
+    # Sleep for a bit because some systems don't accept two ping requests
+    # which are immediately after one another.
+    #
+    sleep(1);
+
+    #
     # Do a second ping and get the round-trip time in msec
     #
     $s = $bpc->cmdSystemOrEval($pingCmd, undef, $args);

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
BackupPC-devel mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-devel
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.