doWrite() — netty Function Reference
Architecture documentation for the doWrite() function in QuicheQuicChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 94bdb859_cdac_c82f_fdeb_766b4f22314a["doWrite()"] 3c534d05_bb5b_c991_5e03_7ec94e739cf7["QuicheQuicChannel"] 94bdb859_cdac_c82f_fdeb_766b4f22314a -->|defined in| 3c534d05_bb5b_c991_5e03_7ec94e739cf7 61f8fdce_72e6_29ed_0ac0_46f9f3d61c4c["sendDatagram()"] 94bdb859_cdac_c82f_fdeb_766b4f22314a -->|calls| 61f8fdce_72e6_29ed_0ac0_46f9f3d61c4c d21171a6_3135_05f4_7ac2_3fd3258ddab8["forceFlushParent()"] 94bdb859_cdac_c82f_fdeb_766b4f22314a -->|calls| d21171a6_3135_05f4_7ac2_3fd3258ddab8 d7575fb7_9073_0e3e_6ab3_7d2612f1eb16["flushParent()"] 94bdb859_cdac_c82f_fdeb_766b4f22314a -->|calls| d7575fb7_9073_0e3e_6ab3_7d2612f1eb16 style 94bdb859_cdac_c82f_fdeb_766b4f22314a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java lines 668–741
@Override
protected void doWrite(ChannelOutboundBuffer channelOutboundBuffer) throws Exception {
if (!supportsDatagram) {
throw new UnsupportedOperationException("Datagram extension is not supported");
}
boolean sendSomething = false;
boolean retry = false;
QuicheQuicConnection conn = connection;
try {
for (;;) {
ByteBuf buffer = (ByteBuf) channelOutboundBuffer.current();
if (buffer == null) {
break;
}
int readable = buffer.readableBytes();
if (readable == 0) {
// Skip empty buffers.
channelOutboundBuffer.remove();
continue;
}
final int res;
if (!buffer.isDirect() || buffer.nioBufferCount() > 1) {
ByteBuf tmpBuffer = alloc().directBuffer(readable);
try {
tmpBuffer.writeBytes(buffer, buffer.readerIndex(), readable);
res = sendDatagram(conn, tmpBuffer);
} finally {
tmpBuffer.release();
}
} else {
res = sendDatagram(conn, buffer);
}
if (res >= 0) {
channelOutboundBuffer.remove();
sendSomething = true;
retry = false;
} else {
if (res == Quiche.QUICHE_ERR_BUFFER_TOO_SHORT) {
retry = false;
channelOutboundBuffer.remove(new BufferUnderflowException());
} else if (res == Quiche.QUICHE_ERR_INVALID_STATE) {
throw new UnsupportedOperationException("Remote peer does not support Datagram extension");
} else if (res == Quiche.QUICHE_ERR_DONE) {
if (retry) {
// We already retried and it didn't work. Let's drop the datagrams on the floor.
for (;;) {
if (!channelOutboundBuffer.remove()) {
// The buffer is empty now.
return;
}
}
}
// Set sendSomething to false a we will call connectionSend() now.
sendSomething = false;
// If this returned DONE we couldn't write anymore. This happens if the internal queue
// is full. In this case we should call quiche_conn_send(...) and so make space again.
if (connectionSend(conn) != SendResult.NONE) {
forceFlushParent();
}
// Let's try again to write the message.
retry = true;
} else {
throw Quiche.convertToException(res);
}
}
}
} finally {
if (sendSomething && connectionSend(conn) != SendResult.NONE) {
flushParent();
}
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does doWrite() do?
doWrite() is a function in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java.
Where is doWrite() defined?
doWrite() is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicChannel.java at line 668.
What does doWrite() call?
doWrite() calls 3 function(s): flushParent, forceFlushParent, sendDatagram.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free