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

Code before:
            if (socket.markClosed()) {
                int fd = fd().intValue();
                IoUringIoOps ops = IoUringIoOps.newClose(fd, flags((byte) 0), nextOpsId());
                registration.submit(ops);
            }
        } else {
            // This one was never registered just use a syscall to close.
            socket.close();
            ioUringUnsafe().freeResourcesNowIfNeeded(null);
        }
    }

    @Override
    protected final void doBeginRead() {
        if (inputClosedSeenErrorOnRead) {
            // We did see an error while reading and so closed the input. Stop reading.
            return;
        }
        if (readPending) {
            // We already have a read pending.
            return;
        }
        readPending = true;
        if (inReadComplete || !isActive()) {
            // We are currently in the readComplete(...) callback which might issue more reads by itself.
            // If readComplete(...) will not issue more reads itself it will pick up he readPending flag, reset it and
            // call doBeginReadNow().
            return;
        }
        doBeginReadNow();
    }

    private void doBeginReadNow() {
        if (!isPollInFirst()) {
            // If the socket is blocking we will directly call scheduleFirstReadIfNeeded() as we can use FASTPOLL.
            ioUringUnsafe().scheduleFirstReadIfNeeded();
        } else if ((ioState & POLL_IN_SCHEDULED) == 0) {
            ioUringUnsafe().schedulePollIn();
        }
    }

    @Override
    protected void doWrite(ChannelOutboundBuffer in) {
        scheduleWriteIfNeeded(in, true);
    }

    protected void scheduleWriteIfNeeded(ChannelOutboundBuffer in, boolean submitAndRunNow) {
        if ((ioState & WRITE_SCHEDULED) != 0) {
            return;
        }
        if (scheduleWrite(in) > 0) {

Review comment (suggestion):
```suggestion
            // If readComplete(...) will not issue more reads itself it will pick up the readPending flag, reset it and
```

Code after:
            if (socket.markClosed()) {
                int fd = fd().intValue();
                IoUringIoOps ops = IoUringIoOps.newClose(fd, flags((byte) 0), nextOpsId());
                registration.submit(ops);
            }
        } else {
            // This one was never registered just use a syscall to close.
            socket.close();
            ioUringUnsafe().freeResourcesNowIfNeeded(null);
        }
    }

    @Override
    protected final void doBeginRead() {
        if (inputClosedSeenErrorOnRead) {
            // We did see an error while reading and so closed the input. Stop reading.
            return;
        }
        if (readPending) {
            // We already have a read pending.
            return;
        }
        readPending = true;
        if (inReadComplete || !isActive()) {
            // We are currently in the readComplete(...) callback which might issue more reads by itself.
            // If readComplete(...) will not issue more reads itself it will pick up the readPending flag, reset it and
            // call doBeginReadNow().
            return;
        }
        doBeginReadNow();
    }

    private void doBeginReadNow() {
        if (!isPollInFirst()) {
            // If the socket is blocking we will directly call scheduleFirstReadIfNeeded() as we can use FASTPOLL.
            ioUringUnsafe().scheduleFirstReadIfNeeded();
        } else if ((ioState & POLL_IN_SCHEDULED) == 0) {
            ioUringUnsafe().schedulePollIn();
        }
    }

    @Override
    protected void doWrite(ChannelOutboundBuffer in) {
        scheduleWriteIfNeeded(in, true);
    }

    protected void scheduleWriteIfNeeded(ChannelOutboundBuffer in, boolean submitAndRunNow) {
        if ((ioState & WRITE_SCHEDULED) != 0) {
            return;
        }
        if (scheduleWrite(in) > 0) {