Repository: netty/netty
File: transport-native-epoll/src/main/c/netty_epoll_linuxsocket.c (C)

Code before:

static void netty_epoll_linuxsocket_setTcpKeepIdle(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPIDLE, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpKeepIntvl(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPINTVL, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpKeepCnt(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPCNT, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpUserTimeout(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setIpBindAddressNoPort(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &optval, sizeof(optval));
}

static void netty5_epoll_linuxsocket_setIpMulticastAll(JNIEnv* env, jclass clazz, jint fd, jboolean ipv6, jint optval) {
    if (ipv6 == JNI_TRUE) {
        netty5_unix_socket_setOption(env, fd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &optval, sizeof(optval));
    } else {
        netty5_unix_socket_setOption(env, fd, IPPROTO_IP, IP_MULTICAST_ALL, &optval, sizeof(optval));
    }
}

static jint netty5_epoll_linuxsocket_isIpMulticastAll(JNIEnv* env, jclass clazz, jint fd, jboolean ipv6) {
    if (ipv6 == JNI_TRUE) {
        int optval;
        if (netty5_unix_socket_getOption(env, fd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &optval, sizeof(optval)) == -1) {
            return -1;
        }
        return optval;
    } else {
        int optval;
        if (netty5_unix_socket_getOption(env, fd, IPPROTO_IP, IP_MULTICAST_ALL, &optval, sizeof(optval)) == -1) {
            return -1;
        }
        return optval;
    }
}

static void netty_epoll_linuxsocket_setIpFreeBind(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_IP, IP_FREEBIND, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setIpTransparent(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, SOL_IP, IP_TRANSPARENT, &optval, sizeof(optval));

Review comment (suggestion):
```suggestion
        netty_unix_socket_setOption(env, fd, IPPROTO_IP, IP_MULTICAST_ALL, &optval, sizeof(optval));
```

Code after:

static void netty_epoll_linuxsocket_setTcpKeepIdle(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPIDLE, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpKeepIntvl(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPINTVL, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpKeepCnt(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_KEEPCNT, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setTcpUserTimeout(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setIpBindAddressNoPort(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setIpMulticastAll(JNIEnv* env, jclass clazz, jint fd, jboolean ipv6, jint optval) {
    if (ipv6 == JNI_TRUE) {
        netty_unix_socket_setOption(env, fd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &optval, sizeof(optval));
    } else {
        netty_unix_socket_setOption(env, fd, IPPROTO_IP, IP_MULTICAST_ALL, &optval, sizeof(optval));
    }
}

static jint netty_epoll_linuxsocket_isIpMulticastAll(JNIEnv* env, jclass clazz, jint fd, jboolean ipv6) {
    if (ipv6 == JNI_TRUE) {
        int optval;
        if (netty_unix_socket_getOption(env, fd, IPPROTO_IPV6, IPV6_MULTICAST_ALL, &optval, sizeof(optval)) == -1) {
            return -1;
        }
        return optval;
    } else {
        int optval;
        if (netty_unix_socket_getOption(env, fd, IPPROTO_IP, IP_MULTICAST_ALL, &optval, sizeof(optval)) == -1) {
            return -1;
        }
        return optval;
    }
}

static void netty_epoll_linuxsocket_setIpFreeBind(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, IPPROTO_IP, IP_FREEBIND, &optval, sizeof(optval));
}

static void netty_epoll_linuxsocket_setIpTransparent(JNIEnv* env, jclass clazz, jint fd, jint optval) {
    netty_unix_socket_setOption(env, fd, SOL_IP, IP_TRANSPARENT, &optval, sizeof(optval));