Home / Function/ recvmsgComplete() — netty Function Reference

recvmsgComplete() — netty Function Reference

Architecture documentation for the recvmsgComplete() function in IoUringDatagramChannel.java from the netty codebase.

Function java Buffer Search called by 1

Entity Profile

Dependency Diagram

graph TD
  c5570cd2_0dd7_0431_e465_f4f118304cf7["recvmsgComplete()"]
  84fa1210_78f7_d596_04d2_ce3b690b2252["IoUringDatagramChannelUnsafe"]
  c5570cd2_0dd7_0431_e465_f4f118304cf7 -->|defined in| 84fa1210_78f7_d596_04d2_ce3b690b2252
  d3789b6f_ecb7_8b61_ce80_a4927993c3f5["readComplete0()"]
  d3789b6f_ecb7_8b61_ce80_a4927993c3f5 -->|calls| c5570cd2_0dd7_0431_e465_f4f118304cf7
  style c5570cd2_0dd7_0431_e465_f4f118304cf7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java lines 422–469

        private void recvmsgComplete(ChannelPipeline pipeline, IoUringRecvByteAllocatorHandle allocHandle,
                                      ByteBuf byteBuf, int res, int flags, int idx, int outstanding)
                throws IOException {
            MsgHdrMemory hdr = recvmsgHdrs.hdr(idx);
            if (res < 0) {
                if (res != Native.ERRNO_ECANCELED_NEGATIVE) {
                    // If res is negative we should pass it to ioResult(...) which will either throw
                    // or convert it to 0 if we could not read because the socket was not readable.
                    allocHandle.lastBytesRead(ioResult("io_uring recvmsg", res));
                }
            } else {
                allocHandle.lastBytesRead(res);
                if (hdr.hasPort(IoUringDatagramChannel.this)) {
                    allocHandle.incMessagesRead(1);
                    DatagramPacket packet = hdr.get(
                            IoUringDatagramChannel.this, registration().attachment(), byteBuf, res);
                    pipeline.fireChannelRead(packet);
                }
            }

            // Reset the id as this read was completed and so don't need to be cancelled later.
            recvmsgHdrs.setId(idx, MsgHdrMemoryArray.NO_ID);
            if (outstanding == 0) {
                // There are no outstanding completion events, release the readBuffer and see if we need to schedule
                // another one or if the user will do it.
                this.readBuffer.release();
                this.readBuffer = null;
                recvmsgHdrs.clear();

                if (res != Native.ERRNO_ECANCELED_NEGATIVE) {
                    if (allocHandle.lastBytesRead() > 0 &&
                            allocHandle.continueReading(UncheckedBooleanSupplier.TRUE_SUPPLIER) &&
                            // If IORING_CQE_F_SOCK_NONEMPTY is supported we should check for it first before
                            // trying to schedule a read. If it's supported and not part of the flags we know for sure
                            // that the next read (which would be using Native.MSG_DONTWAIT) will complete without
                            // be able to read any data. This is useless work and we can skip it.
                            (!IoUring.isCqeFSockNonEmptySupported() ||
                                    (flags & Native.IORING_CQE_F_SOCK_NONEMPTY) != 0)) {
                        // Let's schedule another read.
                        scheduleRead(false);
                    } else {
                        // the read was completed with EAGAIN.
                        allocHandle.readComplete();
                        pipeline.fireChannelReadComplete();
                    }
                }
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does recvmsgComplete() do?
recvmsgComplete() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java.
Where is recvmsgComplete() defined?
recvmsgComplete() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDatagramChannel.java at line 422.
What calls recvmsgComplete()?
recvmsgComplete() is called by 1 function(s): readComplete0.

Analyze Your Own Codebase

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

Try Supermodel Free