Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
[network] Interpret ConnectException as service absent rather than pr…
Browse files Browse the repository at this point in the history
…esent. (#3501)

* Interpret ConnectException as service absent rather than service present.
* Use multicatch for servicePing exception handling.

Signed-off-by: John Sichi <jsichi@gmail.com> (github: jsichi)
  • Loading branch information
jsichi authored and wborn committed Apr 21, 2018
1 parent 2d34fd1 commit 99358b7
Showing 1 changed file with 1 addition and 6 deletions.
Expand Up @@ -159,13 +159,8 @@ public boolean servicePing(String host, int port, int timeout) throws IOExceptio
try (Socket socket = new Socket()) {
socket.connect(socketAddress, timeout);
return true;
} catch (NoRouteToHostException ignored) {
} catch (ConnectException | SocketTimeoutException | NoRouteToHostException ignored) {
return false;
} catch (SocketTimeoutException ignored) {
return false;
} catch (ConnectException e) {
// Connection refused, there is a device on the other end though
return true;
}
}

Expand Down

0 comments on commit 99358b7

Please sign in to comment.