On Wed, Feb 20, 2002 at 06:56:53PM -0500, L. Leo wrote: > When using PoCo::Client::Ping I would get both the ping response > event 'pong' and a timeout for the same 'ping' request. It seems > to me that the correct behavior is to get a 'pong' XOR a timeout. > > However, the timeout is where the cleanup occurs for the > PoCo::Client::Ping internal data structures. So I copied & tweaked > the cleanup cleanup code to the end of the poco_ping_pong() event > handler. > > Also there looked like a typo (spurious comma) where setting the delay. > > Here is the patch.
[patch] A single ICMP echo request may generate multiple replies if the target address is a subnet containing more than one device. Ending the ping request after the first response will impair PoCo::Client::Ping's ability to detect multiple machines on a subnet ping. For example: 3) eyrie:/home/troc# sysctl net.inet.icmp.bmcastecho=1 net.inet.icmp.bmcastecho: 0 -> 1 3) eyrie:/home/troc# ping 10.255.255.255 PING 10.255.255.255 (10.255.255.255): 56 data bytes 64 bytes from 10.0.0.25: icmp_seq=0 ttl=64 time=0.130 ms 64 bytes from 10.255.255.255: icmp_seq=0 ttl=30 time=3.273 ms (DUP!) ... Without a reliable way of knowing how many responses to expect ahead of time, PoCo::Client::Ping is forced to wait the entire timeout interval. It sends the timeout event, even if a reply was received, as a way to indicate the end of a reply window. If there's a better way, I'd really like to know. Squelching duplicate replies just doesn't seem to be the right thing to do. I'll fix the comma, though. :) -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net
