Skip to content

Commit

Permalink
Handle EHOSTUNREACH errors in io.netty.channel.unix.Errors (#13317) (#…
Browse files Browse the repository at this point in the history
…13318)

Motivation:

    We should throw a NoRouteToHostException when a socket connection fails with EHOSTUNREACH in the same way as
    ENETUNREACH.

    Modifications:

    Add handling for EHOSTUNREACH

    Result:

    Correct exception is thrown.
  • Loading branch information
tristantarrant authored and normanmaurer committed Apr 3, 2023
1 parent 2a256db commit 20f4c07
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static String errnoString(int err) {
}

private static IOException newConnectException0(String method, int err) {
if (err == ERROR_ENETUNREACH_NEGATIVE) {
if (err == ERROR_ENETUNREACH_NEGATIVE || err == ERROR_EHOSTUNREACH_NEGATIVE) {
return new NoRouteToHostException();
}
if (err == ERROR_EISCONN_NEGATIVE) {
Expand Down

0 comments on commit 20f4c07

Please sign in to comment.