Throw IOException (not ChannelException) if netty_epoll_linuxsocket_setTcpMd5Sig fails (#9039)

Motivation:

At the moment we throw a ChannelException if netty_epoll_linuxsocket_setTcpMd5Sig fails. This is inconsistent with other methods which throw a IOException.

Modifications:

Throw IOException

Result:

More correct and consistent exception usage in epoll transport
This commit is contained in:
Norman Maurer 2019-04-12 15:15:27 +02:00 committed by GitHub
parent 778ff2057e
commit fcfa9eb9a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -292,7 +292,7 @@ static void netty_epoll_linuxsocket_setTcpMd5Sig(JNIEnv* env, jclass clazz, jint
struct sockaddr_storage addr; struct sockaddr_storage addr;
socklen_t addrSize; socklen_t addrSize;
if (netty_unix_socket_initSockaddr(env, address, scopeId, 0, &addr, &addrSize) == -1) { if (netty_unix_socket_initSockaddr(env, address, scopeId, 0, &addr, &addrSize) == -1) {
netty_unix_errors_throwChannelExceptionError(env, "Could not init sockaddr"); netty_unix_errors_throwIOException(env, "Could not init sockaddr");
return; return;
} }
@ -323,7 +323,7 @@ static void netty_epoll_linuxsocket_setTcpMd5Sig(JNIEnv* env, jclass clazz, jint
} }
if (setsockopt(fd, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof(md5sig)) < 0) { if (setsockopt(fd, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof(md5sig)) < 0) {
netty_unix_errors_throwChannelExceptionErrorNo(env, "setsockopt() failed: ", errno); netty_unix_errors_throwIOExceptionErrorNo(env, "setsockopt() failed: ", errno);
} }
} }