Closes #269 - macOS JVM can wrongly report "No route to host" as ConnectionException instead of NoRouteToHostException, so we cannot handle ConnectException itself

This commit is contained in:
Anton Keks 2021-01-22 18:25:34 +02:00
parent 2358a61c14
commit f58570976b

View File

@ -16,7 +16,7 @@ import java.net.SocketTimeoutException;
import java.util.logging.Logger;
import static java.lang.Math.min;
import static java.util.logging.Level.FINER;
import static java.util.logging.Level.INFO;
import static net.azib.ipscan.util.IOUtils.closeQuietly;
/**
@ -68,7 +68,7 @@ public class TCPPinger implements Pinger {
catch (IOException e) {
String msg = e.getMessage();
// RST should result in ConnectException, but on macOS ConnectionException can also come from dead hosts
// RST should result in ConnectException, but on macOS ConnectionException can also come with e.g. "No route to host"
if (msg.contains(/*Connection*/"refused")) {
// we've got an RST packet from the host - it is alive
success(result, startTime);
@ -81,7 +81,7 @@ public class TCPPinger implements Pinger {
}
else {
// something unknown
LOG.log(FINER, subject.toString(), e);
LOG.log(INFO, subject.toString(), e);
}
}
finally {