ok, i like the idea of catching this situation in my application

however, i'm having trouble distinguishing between the case where send() fails and the case where send() succeeds but the target does not return an ICMP Reply

client_got_pong {
  [...]
  my ($request, $response) = @_[ARG0, ARG1];
  [...]
  my ($resp_address, $roundtrip_time, $resp_time, $resp_ttl) = @{$response};

  if (defined $resp_address) {
      # Celebrate receiving the ICMP Reply
  }
  else {
      if (not defined $roundtrip_time and not defined $resp_ttl) {
          # Whine about the call to send() failing
      }
      else {
          # Weep about the ICMP Reply not appearing
      }
  }

  [...]
}

but, in fact, $roundtrip_time and $resp_ttl are undefined for both cases: the case in which send() failed and the case in which the ICMP Reply didn't arrive

how might i distinguish between the two cases?

--sk




Rocco Caputo wrote:
The post($sender, $event, ....) call sends $event response back to your code if send() fails. The response address, round-trip time, and TTL are undefined. The response time is "now".

You've added logging in a good place, if you want to solve this by modifying the module. It might be better to catch the $event in your application and log the problem there.

Reply via email to