On Thu, 12 Jul 2007, Stefano Cislaghi wrote: > sub client_got_pong { > my ( $kernel, $session ) = @_[ KERNEL, SESSION ]; > > # The original request is returned as the first parameter. It > # contains the address we wanted to ping, the total time to wait for > # a response, and the time the request was made. > > my $request_packet = $_[ARG0]; > my ( $request_address, $request_timeout, $request_time ) = > @{$request_packet}; > > # The response information is returned as the second parameter. It > # contains the response address (which may be different from the > # request address), the ping's round-trip time, and the time the > # reply was received. > > my $response_packet = $_[ARG1]; > my ( $response_address, $roundtrip_time, $reply_time ) = > @{$response_packet}; > > # It is impossible to know ahead of time how many ICMP ping > # responses will arrive for a particular address, so the component > # always waits PING_TIMEOUT seconds. An undefined response address > # signals that this waiting period has ended. > > if ( defined $response_address ) { > printf( "%-15.15s up %6.3fs\n", > $request_address, $roundtrip_time > ); > } > else { > printf( "%-15.15s down 0.000\n",$request_address) ; > } > }
Here's the part I'm talking about, this last else stanza. It will fire, every time. Try this: my ($req_address, $req_timeout, $req_time) = @$request; my ($resp_address, $roundtrip_time, $resp_time, $resp_ttl) = @$response; # The response address is defined if this is a response. if (defined $resp_address) { output("$resp_address is having a party\n"); } elsif(defined $req_address) { output("Ping timeout: $req_address"); } else { print("Pong: empty event?\n"); } - billn