Repository: netty/netty
File: transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java (Java)

Code before:
    }

    private static boolean useIpv6(SocketProtocolFamily family) {
        if (family == null) {
            return Socket.isIPv6Preferred();
        }
        return family == SocketProtocolFamily.INET6;
    }

    /**
     * Create a new instance which selects the {@link SocketProtocolFamily} to use depending
     * on the Operation Systems default which will be chosen.
     */
    public IoUringDatagramChannel(int fd) {
        this(new LinuxSocket(fd), true);
    }

    private IoUringDatagramChannel(LinuxSocket fd, boolean active) {
        // Always use a blocking fd and so make use of fast-poll.
        super(null, fd, active);

        // Configure IP_MULTICAST_ALL - disable by default to match the behaviour of NIO.
        try {
            fd.setIpMulticastAll(IP_MULTICAST_ALL);
        } catch (IOException e) {
            logger.warn("Failed to set IP_MULTICAST_ALL to {}", IP_MULTICAST_ALL, e);
        }

        config = new IoUringDatagramChannelConfig(this);
    }

    @Override
    public InetSocketAddress remoteAddress() {
        return (InetSocketAddress) super.remoteAddress();
    }

    @Override
    public InetSocketAddress localAddress() {
        return (InetSocketAddress) super.localAddress();
    }

    @Override
    public ChannelMetadata metadata() {
        return METADATA;
    }

    @Override
    public boolean isActive() {
        return socket.isOpen() && (config.getActiveOnOpen() && isRegistered() || super.isActive());
    }


Review comment (bug):
```suggestion
            logger.debug("Failed to set IP_MULTICAST_ALL to {}", IP_MULTICAST_ALL, e);
```

Code after:

    private static boolean useIpv6(SocketProtocolFamily family) {
        if (family == null) {
            return Socket.isIPv6Preferred();
        }
        return family == SocketProtocolFamily.INET6;
    }

    /**
     * Create a new instance which selects the {@link SocketProtocolFamily} to use depending
     * on the Operation Systems default which will be chosen.
     */
    public IoUringDatagramChannel(int fd) {
        this(new LinuxSocket(fd), true);
    }

    private IoUringDatagramChannel(LinuxSocket fd, boolean active) {
        // Always use a blocking fd and so make use of fast-poll.
        super(null, fd, active);

        // Configure IP_MULTICAST_ALL - disable by default to match the behaviour of NIO.
        try {
            fd.setIpMulticastAll(IP_MULTICAST_ALL);
        } catch (IOException e) {
            logger.debug("Failed to set IP_MULTICAST_ALL to {}", IP_MULTICAST_ALL, e);
        }

        config = new IoUringDatagramChannelConfig(this);
    }

    @Override
    public InetSocketAddress remoteAddress() {
        return (InetSocketAddress) super.remoteAddress();
    }

    @Override
    public InetSocketAddress localAddress() {
        return (InetSocketAddress) super.localAddress();
    }

    @Override
    public ChannelMetadata metadata() {
        return METADATA;
    }

    @Override
    public boolean isActive() {
        return socket.isOpen() && (config.getActiveOnOpen() && isRegistered() || super.isActive());
    }

    @Override