readReady() — netty Function Reference
Architecture documentation for the readReady() function in AbstractKQueueStreamChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD fdaf9f05_9ac5_91fc_0d36_89416c50ee16["readReady()"] 9d9cd790_d6e0_6f39_011d_e69a35e7c41f["KQueueStreamUnsafe"] fdaf9f05_9ac5_91fc_0d36_89416c50ee16 -->|defined in| 9d9cd790_d6e0_6f39_011d_e69a35e7c41f 992cf68c_d981_2e34_b60d_f19218c38fe8["handleReadException()"] fdaf9f05_9ac5_91fc_0d36_89416c50ee16 -->|calls| 992cf68c_d981_2e34_b60d_f19218c38fe8 style fdaf9f05_9ac5_91fc_0d36_89416c50ee16 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java lines 512–576
@Override
void readReady(final KQueueRecvByteAllocatorHandle allocHandle) {
final ChannelConfig config = config();
if (shouldBreakReadReady(config)) {
clearReadFilter0();
return;
}
final ChannelPipeline pipeline = pipeline();
final ByteBufAllocator allocator = config.getAllocator();
allocHandle.reset(config);
ByteBuf byteBuf = null;
boolean close = false;
try {
do {
// we use a direct buffer here as the native implementations only be able
// to handle direct buffers.
byteBuf = allocHandle.allocate(allocator);
allocHandle.lastBytesRead(doReadBytes(byteBuf));
if (allocHandle.lastBytesRead() <= 0) {
// nothing was read, release the buffer.
byteBuf.release();
byteBuf = null;
close = allocHandle.lastBytesRead() < 0;
if (close) {
// There is nothing left to read as we received an EOF.
readPending = false;
}
break;
}
allocHandle.incMessagesRead(1);
readPending = false;
pipeline.fireChannelRead(byteBuf);
byteBuf = null;
if (shouldBreakReadReady(config)) {
// We need to do this for two reasons:
//
// - If the input was shutdown in between (which may be the case when the user did it in the
// fireChannelRead(...) method we should not try to read again to not produce any
// miss-leading exceptions.
//
// - If the user closes the channel we need to ensure we not try to read from it again as
// the filedescriptor may be re-used already by the OS if the system is handling a lot of
// concurrent connections and so needs a lot of filedescriptors. If not do this we risk
// reading data from a filedescriptor that belongs to another socket then the socket that
// was "wrapped" by this Channel implementation.
break;
}
} while (allocHandle.continueReading());
allocHandle.readComplete();
pipeline.fireChannelReadComplete();
if (close) {
shutdownInput(false);
}
} catch (Throwable t) {
handleReadException(pipeline, byteBuf, t, close, allocHandle);
} finally {
if (shouldStopReading(config)) {
clearReadFilter0();
}
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does readReady() do?
readReady() is a function in the netty codebase, defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java.
Where is readReady() defined?
readReady() is defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java at line 512.
What does readReady() call?
readReady() calls 1 function(s): handleReadException.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free