Yup. To elabourate: If we set a small timeout for a faraway host with a high ping, IcmpSendEcho can report success even if the rtt exceeded the timeout, hence the need for this explicit check.
-Rob On 21/09/16 11:07, Vyom Tewari wrote: > So InetAddress.isReachable() will return false if the underline API > IcmpSendEcho return with Status== IP_SUCESS and RoundTripTime > timeout. > > Vyom > > > On Wednesday 21 September 2016 10:39 PM, Rob McKenna wrote: > >Unfortunately the behaviour described is undocumented and was found the hard > >way. This part of the code is a necessity though. > > > > -Rob > > > >On 21/09/16 09:48, Vyom Tewari wrote: > >>Hi Rob, > >> > >>Do you really think this extra check is required ? > >> > >>if (pEchoReply->Status == IP_SUCCESS > >>+ && (int)pEchoReply->RoundTripTime <= timeout) I did not found any > >>doc(MSDN) which explains this. I think in case of IP_SUCCESS "RoundTripTime" > >>is always less than timeout. I think similar changes is required in > >>Inet6Address.c as well ? Thanks, Vyom > >> > >> > >>On Wednesday 21 September 2016 08:46 PM, Rob McKenna wrote: > >>>Hi folks, > >>> > >>>I'd like to fix a bug caused by an incorrect assumption. The IcmpSendEcho* > >>>calls can actually return a similar set of errors regardless of whether > >>>the call itself failed or succeeded. This change checks that both the call > >>>and the ping were successful. In addition to that it takes a number of > >>>common failure causes into account before deciding to throw an exception. > >>> > >>>http://cr.openjdk.java.net/~robm/8159410/webrev.01/ > >>> > >>> -Rob >