readComplete() — netty Function Reference
Architecture documentation for the readComplete() function in AbstractIoUringChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3695afb9_15b2_6326_e381_ade2ba128b2a["readComplete()"] 19011d76_ce85_4831_bbdf_3b21a88f2b1b["AbstractUringUnsafe"] 3695afb9_15b2_6326_e381_ade2ba128b2a -->|defined in| 19011d76_ce85_4831_bbdf_3b21a88f2b1b 0a6e9843_e51b_43db_7e40_36ac0122913f["doBeginRead()"] 0a6e9843_e51b_43db_7e40_36ac0122913f -->|calls| 3695afb9_15b2_6326_e381_ade2ba128b2a 5f45f466_5da9_76a6_e49e_f54bf3e34ae8["handle()"] 5f45f466_5da9_76a6_e49e_f54bf3e34ae8 -->|calls| 3695afb9_15b2_6326_e381_ade2ba128b2a c0310be4_6806_6e43_78c2_313adfdc6948["socketIsEmpty()"] 3695afb9_15b2_6326_e381_ade2ba128b2a -->|calls| c0310be4_6806_6e43_78c2_313adfdc6948 108086e1_c0ab_b906_f91e_a87001464a45["readComplete0()"] 3695afb9_15b2_6326_e381_ade2ba128b2a -->|calls| 108086e1_c0ab_b906_f91e_a87001464a45 6537cba5_2de7_ad7b_7809_a43f80f2e6f3["doBeginReadNow()"] 3695afb9_15b2_6326_e381_ade2ba128b2a -->|calls| 6537cba5_2de7_ad7b_7809_a43f80f2e6f3 4322bd6c_f77e_8852_f769_2518a4dfe305["cancelOutstandingReads()"] 3695afb9_15b2_6326_e381_ade2ba128b2a -->|calls| 4322bd6c_f77e_8852_f769_2518a4dfe305 style 3695afb9_15b2_6326_e381_ade2ba128b2a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java lines 729–807
private void readComplete(byte op, int res, int flags, short data) {
assert numOutstandingReads > 0 || numOutstandingReads == -1 : numOutstandingReads;
boolean multishot = numOutstandingReads == -1;
boolean rearm = (flags & Native.IORING_CQE_F_MORE) == 0;
if (rearm) {
// Reset READ_SCHEDULED if there is nothing more to handle and so we need to re-arm. This works for
// multi-shot and non multi-shot variants.
ioState &= ~READ_SCHEDULED;
}
boolean pending = readPending;
if (multishot) {
// Reset readPending so we can still keep track if we might need to cancel the multi-shot read or
// not.
readPending = false;
} else if (--numOutstandingReads == 0) {
// We received all outstanding completions.
readPending = false;
ioState &= ~READ_SCHEDULED;
}
inReadComplete = true;
try {
socketIsEmpty = socketIsEmpty(flags);
socketHasMoreData = IoUring.isCqeFSockNonEmptySupported() &&
(flags & Native.IORING_CQE_F_SOCK_NONEMPTY) != 0;
readComplete0(op, res, flags, data, numOutstandingReads);
} finally {
try {
// Check if we should consider the read loop to be done.
if (recvBufAllocHandle().isReadComplete()) {
// Reset the handle as we are done with the read-loop.
recvBufAllocHandle().reset(config());
// Check if this was a readComplete(...) triggered by a read or multi-shot read.
if (!multishot) {
if (readPending) {
// This was a "normal" read and the user did signal we should continue reading.
// Let's schedule the read now.
doBeginReadNow();
}
} else {
// The readComplete(...) was triggered by a multi-shot read. Because of this the state
// machine is a bit more complicated.
if (res == Native.ERRNO_ECANCELED_NEGATIVE) {
// The readComplete(...) was triggered because the previous read was cancelled.
// In this case we we need to check if the user did signal the desire to read again
// in the meantime. If this is the case we need to schedule the read to ensure
// we do not stall.
if (pending) {
doBeginReadNow();
}
} else if (rearm) {
// We need to rearm the multishot as otherwise we might miss some data.
doBeginReadNow();
} else if (!readPending) {
// Cancel the multi-shot read now as the user did not signal that we want to keep
// reading while we handle the completion event.
cancelOutstandingReads(registration, numOutstandingReads);
}
}
} else if (res == Native.ERRNO_ECANCELED_NEGATIVE) {
// The readComplete(...) was triggered because the previous read was cancelled.
// In this case we we need to check if the user did signal the desire to read again
// in the meantime. If this is the case we need to schedule the read to ensure
// we do not stall.
if (pending) {
doBeginReadNow();
}
} else if (multishot && rearm) {
// We need to rearm the multishot as otherwise we might miss some data.
doBeginReadNow();
}
} finally {
inReadComplete = false;
socketIsEmpty = false;
}
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does readComplete() do?
readComplete() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java.
Where is readComplete() defined?
readComplete() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/AbstractIoUringChannel.java at line 729.
What does readComplete() call?
readComplete() calls 4 function(s): cancelOutstandingReads, doBeginReadNow, readComplete0, socketIsEmpty.
What calls readComplete()?
readComplete() is called by 2 function(s): doBeginRead, handle.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free