Home / Function/ writeComplete() — netty Function Reference

writeComplete() — netty Function Reference

Architecture documentation for the writeComplete() function in AbstractIoUringChannel.java from the netty codebase.

Function java Buffer Telemetry calls 7 called by 1

Entity Profile

Dependency Diagram

graph TD
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf["writeComplete()"]
  19011d76_ce85_4831_bbdf_3b21a88f2b1b["AbstractUringUnsafe"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|defined in| 19011d76_ce85_4831_bbdf_3b21a88f2b1b
  5f45f466_5da9_76a6_e49e_f54bf3e34ae8["handle()"]
  5f45f466_5da9_76a6_e49e_f54bf3e34ae8 -->|calls| 02484f5e_fddd_74b7_e73c_1b14fb1d53cf
  74154ae0_fd75_6c44_c1e5_89945141fcf3["freeMsgHdrArray()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| 74154ae0_fd75_6c44_c1e5_89945141fcf3
  793ea166_f553_4dcf_4a30_68f00e4e6f0f["connect()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| 793ea166_f553_4dcf_4a30_68f00e4e6f0f
  7ca63cf2_401d_5282_550f_f023bb1b2458["connectComplete()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| 7ca63cf2_401d_5282_550f_f023bb1b2458
  bc850991_35d5_bd07_eff9_1c3e0ca878dc["submitConnect()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| bc850991_35d5_bd07_eff9_1c3e0ca878dc
  bfc19d00_9fa1_2cfb_be37_2d2f52d6e318["writeComplete0()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| bfc19d00_9fa1_2cfb_be37_2d2f52d6e318
  9297de32_6d49_794c_9a51_19eaa6d72911["schedulePollOut()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| 9297de32_6d49_794c_9a51_19eaa6d72911
  adbff36e_3fab_adc8_b02f_f7c4cd0323d6["scheduleWriteIfNeeded()"]
  02484f5e_fddd_74b7_e73c_1b14fb1d53cf -->|calls| adbff36e_3fab_adc8_b02f_f7c4cd0323d6
  style 02484f5e_fddd_74b7_e73c_1b14fb1d53cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java lines 947–993

        private void writeComplete(byte op, int res, int flags, short data) {
            if ((ioState & CONNECT_SCHEDULED) != 0) {
                // The writeComplete(...) callback was called because of a sendmsg(...) result that was used for
                // TCP_FASTOPEN_CONNECT.
                freeMsgHdrArray();
                if (res > 0) {
                    // Connect complete!
                    outboundBuffer().removeBytes(res);

                    // Explicit pass in 0 as this is returned by a connect(...) call when it was successful.
                    connectComplete(op, 0, flags, data);
                } else if (res == ERRNO_EINPROGRESS_NEGATIVE || res == 0) {
                    // This happens when we (as a client) have no pre-existing cookie for doing a fast-open connection.
                    // In this case, our TCP connection will be established normally, but no data was transmitted at
                    // this time. We'll just transmit the data with normal writes later.
                    // Let's submit a normal connect.
                    submitConnect((InetSocketAddress) requestedRemoteAddress);
                } else {
                    // There was an error, handle it as a normal connect error.
                    connectComplete(op, res, flags, data);
                }
                return;
            }

            if ((flags & Native.IORING_CQE_F_NOTIF) == 0) {
                assert numOutstandingWrites > 0;
                --numOutstandingWrites;
            }

            boolean writtenAll = writeComplete0(op, res, flags, data, numOutstandingWrites);
            if (!writtenAll && (ioState & POLL_OUT_SCHEDULED) == 0) {

                // We were not able to write everything, let's register for POLLOUT
                schedulePollOut();
            }

            // We only reset this once we are done with calling removeBytes(...) as otherwise we may trigger a write
            // while still removing messages internally in removeBytes(...) which then may corrupt state.
            if (numOutstandingWrites == 0) {
                ioState &= ~WRITE_SCHEDULED;

                // If we could write all and we did not schedule a pollout yet let us try to write again
                if (writtenAll && (ioState & POLL_OUT_SCHEDULED) == 0) {
                    scheduleWriteIfNeeded(unsafe().outboundBuffer(), false);
                }
            }
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does writeComplete() do?
writeComplete() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java.
Where is writeComplete() defined?
writeComplete() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java at line 947.
What does writeComplete() call?
writeComplete() calls 7 function(s): connect, connectComplete, freeMsgHdrArray, schedulePollOut, scheduleWriteIfNeeded, submitConnect, writeComplete0.
What calls writeComplete()?
writeComplete() is called by 1 function(s): handle.

Analyze Your Own Codebase

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

Try Supermodel Free