Home / Class/ IoUringServerSocketChannel Class — netty Architecture

IoUringServerSocketChannel Class — netty Architecture

Architecture documentation for the IoUringServerSocketChannel class in IoUringServerSocketChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7afdfb1c_e11f_1098_0422_fb18184eba53["IoUringServerSocketChannel"]
  350b121d_5fa2_ea4d_dcdd_b0c783f71e1f["IoUringServerSocketChannel.java"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|defined in| 350b121d_5fa2_ea4d_dcdd_b0c783f71e1f
  ce5c9832_6fa7_ee55_2919_bfa4acb7f572["IoUringServerSocketChannel()"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|method| ce5c9832_6fa7_ee55_2919_bfa4acb7f572
  ddae95b5_ff09_97d0_070f_3d58de2b80d3["ServerSocketChannelConfig()"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|method| ddae95b5_ff09_97d0_070f_3d58de2b80d3
  11ff421d_d471_f5e5_0f89_71448e3b001b["Channel()"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|method| 11ff421d_d471_f5e5_0f89_71448e3b001b
  7eee12c3_adda_1a6f_30fd_bc1ea9f71f6e["InetSocketAddress()"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|method| 7eee12c3_adda_1a6f_30fd_bc1ea9f71f6e
  12074d13_3833_88c3_0195_839fca8472ef["doBind()"]
  7afdfb1c_e11f_1098_0422_fb18184eba53 -->|method| 12074d13_3833_88c3_0195_839fca8472ef

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringServerSocketChannel.java lines 27–90

public final class IoUringServerSocketChannel extends AbstractIoUringServerChannel implements ServerSocketChannel {
    private final IoUringServerSocketChannelConfig config;

    public IoUringServerSocketChannel() {
        // We don't use a blocking fd for the server channel at the moment as
        // there is no support for IORING_CQE_F_SOCK_NONEMPTY and IORING_ACCEPT_DONTWAIT
        // at the moment. Once these land in the kernel we should check if we can use these and if so make
        // the fd blocking to get rid of POLLIN etc.
        // See:
        //
        //  - https://lore.kernel.org/netdev/20240509180627.204155-1-axboe@kernel.dk/
        //  - https://lore.kernel.org/io-uring/20240508142725.91273-1-axboe@kernel.dk/
        super(LinuxSocket.newSocketStream(), false);
        this.config = new IoUringServerSocketChannelConfig(this);
    }

    @Override
    public ServerSocketChannelConfig config() {
        return config;
    }

    @Override
    Channel newChildChannel(int fd, ByteBuffer acceptedAddressMemory) {
        IoUringIoHandler handler = registration().attachment();
        LinuxSocket socket = new LinuxSocket(fd);
        if (acceptedAddressMemory != null) {
            // We didnt use ACCEPT_MULTISHOT And so can depend on the addresses.
            final InetSocketAddress address;
            if (socket.isIpv6()) {
                byte[] ipv6Array = handler.inet6AddressArray();
                byte[] ipv4Array = handler.inet4AddressArray();
                address = SockaddrIn.getIPv6(acceptedAddressMemory, ipv6Array, ipv4Array);
            } else {
                byte[] addressArray = handler.inet4AddressArray();
                address = SockaddrIn.getIPv4(acceptedAddressMemory, addressArray);
            }
            return new IoUringSocketChannel(this, new LinuxSocket(fd), address);
        }
        return new IoUringSocketChannel(this, new LinuxSocket(fd));
    }

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

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

    @Override
    public void doBind(SocketAddress localAddress) throws Exception {
        super.doBind(localAddress);
        if (IoUring.isTcpFastOpenServerSideAvailable()) {
            Integer fastOpen = config().getOption(ChannelOption.TCP_FASTOPEN);
            if (fastOpen != null && fastOpen > 0) {
                socket.setTcpFastOpen(fastOpen);
            }
        }
        socket.listen(config.getBacklog());
        active = true;
    }
}

Frequently Asked Questions

What is the IoUringServerSocketChannel class?
IoUringServerSocketChannel is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringServerSocketChannel.java.
Where is IoUringServerSocketChannel defined?
IoUringServerSocketChannel is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringServerSocketChannel.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free