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

Code before:
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.PortUnreachableException;
import java.net.SocketAddress;
import java.nio.channels.UnresolvedAddressException;

import static io.netty.channel.unix.Errors.ioResult;

public final class IoUringDatagramChannel extends AbstractIoUringChannel implements DatagramChannel {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractByteBuf.class);
    private static final boolean IP_MULTICAST_ALL =
            SystemPropertyUtil.getBoolean("io.netty.transport.linux.ipMulticastAll", false);
    private static final ChannelMetadata METADATA = new ChannelMetadata(true, 16);
    private static final String EXPECTED_TYPES =
            " (expected: " + StringUtil.simpleClassName(DatagramPacket.class) + ", " +
            StringUtil.simpleClassName(AddressedEnvelope.class) + '<' +
            StringUtil.simpleClassName(ByteBuf.class) + ", " +
            StringUtil.simpleClassName(InetSocketAddress.class) + ">, " +
            StringUtil.simpleClassName(ByteBuf.class) + ')';

    private final IoUringDatagramChannelConfig config;
    private volatile boolean connected;

    static {
        if (logger.isDebugEnabled()) {
            logger.debug("-Dio.netty.transport.linux.ipMulticastAll: {}", IP_MULTICAST_ALL);
        }
    }

    // These buffers are used for msghdr, iov, sockaddr_in / sockaddr_in6 when doing recvmsg / sendmsg
    //
    // TODO: Alternative we could also allocate these everytime from the ByteBufAllocator or we could use
    //       some sort of other pool. Let's keep it simple for now.
    //
    // Consider exposing some configuration for that.
    private final MsgHdrMemoryArray recvmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final MsgHdrMemoryArray sendmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final int[] sendmsgResArray = new int[sendmsgHdrs.capacity()];

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

    /**
     * Create a new instance using the given {@link SocketProtocolFamily}. If {@code null} is used it will depend
     * on the Operation Systems default which will be chosen.
     */

Review comment (bug):
```suggestion
            logger.debug("-Dio.netty.channel.iouring.ipMulticastAll: {}", IP_MULTICAST_ALL);
```

Code after:
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
import java.net.PortUnreachableException;
import java.net.SocketAddress;
import java.nio.channels.UnresolvedAddressException;

import static io.netty.channel.unix.Errors.ioResult;

public final class IoUringDatagramChannel extends AbstractIoUringChannel implements DatagramChannel {
    private static final InternalLogger logger = InternalLoggerFactory.getInstance(IoUringDatagramChannel.class);
    private static final boolean IP_MULTICAST_ALL =
            SystemPropertyUtil.getBoolean("io.netty.channel.iouring.ipMulticastAll", false);
    private static final ChannelMetadata METADATA = new ChannelMetadata(true, 16);
    private static final String EXPECTED_TYPES =
            " (expected: " + StringUtil.simpleClassName(DatagramPacket.class) + ", " +
            StringUtil.simpleClassName(AddressedEnvelope.class) + '<' +
            StringUtil.simpleClassName(ByteBuf.class) + ", " +
            StringUtil.simpleClassName(InetSocketAddress.class) + ">, " +
            StringUtil.simpleClassName(ByteBuf.class) + ')';

    private final IoUringDatagramChannelConfig config;
    private volatile boolean connected;

    static {
        if (logger.isDebugEnabled()) {
            logger.debug("-Dio.netty.channel.iouring.ipMulticastAll: {}", IP_MULTICAST_ALL);
        }
    }

    // These buffers are used for msghdr, iov, sockaddr_in / sockaddr_in6 when doing recvmsg / sendmsg
    //
    // TODO: Alternative we could also allocate these everytime from the ByteBufAllocator or we could use
    //       some sort of other pool. Let's keep it simple for now.
    //
    // Consider exposing some configuration for that.
    private final MsgHdrMemoryArray recvmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final MsgHdrMemoryArray sendmsgHdrs = new MsgHdrMemoryArray((short) 256);
    private final int[] sendmsgResArray = new int[sendmsgHdrs.capacity()];

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

    /**
     * Create a new instance using the given {@link SocketProtocolFamily}. If {@code null} is used it will depend
     * on the Operation Systems default which will be chosen.
     */