QuicheQuicConnection Class — netty Architecture
Architecture documentation for the QuicheQuicConnection class in QuicheQuicConnection.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc["QuicheQuicConnection"] 58fbed07_fe2c_e7b5_7b01_35ef8d528f4e["QuicheQuicConnection.java"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|defined in| 58fbed07_fe2c_e7b5_7b01_35ef8d528f4e 6cedffba_b076_8dcf_61e5_4331496a5fc8["QuicheQuicConnection()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 6cedffba_b076_8dcf_61e5_4331496a5fc8 90f86e5d_d106_ae0e_a26f_e656ad24bdda["reattach()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 90f86e5d_d106_ae0e_a26f_e656ad24bdda 66d40c76_af71_3495_7ff0_32e690e2d7fd["free()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 66d40c76_af71_3495_7ff0_32e690e2d7fd 25d186c9_9944_a7c9_401f_dfb7486c3813["isFreed()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 25d186c9_9944_a7c9_401f_dfb7486c3813 3a1cfe8a_84b8_5b10_176d_eb5d0733ee47["Runnable()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 3a1cfe8a_84b8_5b10_176d_eb5d0733ee47 f9241753_2305_1ba2_2e12_c228987a56dc["QuicConnectionAddress()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| f9241753_2305_1ba2_2e12_c228987a56dc 08ae4110_ccf0_e4aa_b2f8_f1c72bb47e3e["QuicheQuicTransportParameters()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 08ae4110_ccf0_e4aa_b2f8_f1c72bb47e3e 66470550_1154_45fe_2458_6966f4b7840e["QuicheQuicSslEngine()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 66470550_1154_45fe_2458_6966f4b7840e f07b57fe_1cd4_208f_9f93_0391bf6498af["address()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| f07b57fe_1cd4_208f_9f93_0391bf6498af 2f912ddb_32f2_da6c_f5df_cf6fb03ac746["init()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 2f912ddb_32f2_da6c_f5df_cf6fb03ac746 9bd62745_3513_e6a0_7d70_43db5b25ff57["ByteBuffer()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 9bd62745_3513_e6a0_7d70_43db5b25ff57 2671dcb7_2cac_ab38_be2a_7c249f34afa5["isSendInfoChanged()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| 2671dcb7_2cac_ab38_be2a_7c249f34afa5 e98514c8_8999_e7b2_eb91_a3c96146d808["isClosed()"] 5f5b6955_ffea_5ec8_42dd_bd49352d4bbc -->|method| e98514c8_8999_e7b2_eb91_a3c96146d808
Relationship Graph
Source Code
codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicConnection.java lines 30–233
final class QuicheQuicConnection {
private static final int TOTAL_RECV_INFO_SIZE = Quiche.SIZEOF_QUICHE_RECV_INFO +
Quiche.SIZEOF_SOCKADDR_STORAGE + Quiche.SIZEOF_SOCKADDR_STORAGE;
private static final ResourceLeakDetector<QuicheQuicConnection> leakDetector =
ResourceLeakDetectorFactory.instance().newResourceLeakDetector(QuicheQuicConnection.class);
private final QuicheQuicSslEngine engine;
private final ResourceLeakTracker<QuicheQuicConnection> leakTracker;
final long ssl;
private ReferenceCounted refCnt;
// This block of memory is used to store the following structs (in this order):
// - quiche_recv_info
// - sockaddr_storage
// - quiche_recv_info
// - sockaddr_storage
// - quiche_send_info
// - quiche_send_info
//
// We need to have every stored 2 times as we need to check if the last sockaddr has changed between
// quiche_conn_recv and quiche_conn_send calls. If this happens we know a QUIC connection migration did happen.
private final ByteBuf recvInfoBuffer;
private final ByteBuf sendInfoBuffer;
private boolean sendInfoFirst = true;
private final ByteBuffer recvInfoBuffer1;
private final ByteBuffer sendInfoBuffer1;
private final ByteBuffer sendInfoBuffer2;
private long connection;
QuicheQuicConnection(long connection, long ssl, QuicheQuicSslEngine engine, ReferenceCounted refCnt) {
assert connection != -1;
this.connection = connection;
this.ssl = ssl;
this.engine = engine;
this.refCnt = refCnt;
// TODO: Maybe cache these per thread as we only use them temporary within a limited scope.
recvInfoBuffer = Quiche.allocateNativeOrder(TOTAL_RECV_INFO_SIZE);
sendInfoBuffer = Quiche.allocateNativeOrder(2 * Quiche.SIZEOF_QUICHE_SEND_INFO);
// Let's memset the memory.
recvInfoBuffer.setZero(0, recvInfoBuffer.capacity());
sendInfoBuffer.setZero(0, sendInfoBuffer.capacity());
recvInfoBuffer1 = recvInfoBuffer.nioBuffer(0, TOTAL_RECV_INFO_SIZE);
sendInfoBuffer1 = sendInfoBuffer.nioBuffer(0, Quiche.SIZEOF_QUICHE_SEND_INFO);
sendInfoBuffer2 = sendInfoBuffer.nioBuffer(Quiche.SIZEOF_QUICHE_SEND_INFO, Quiche.SIZEOF_QUICHE_SEND_INFO);
this.engine.connection = this;
leakTracker = leakDetector.track(this);
}
synchronized void reattach(ReferenceCounted refCnt) {
this.refCnt.release();
this.refCnt = refCnt;
}
void free() {
free(true);
}
boolean isFreed() {
return connection == -1;
}
private void free(boolean closeLeakTracker) {
boolean release = false;
synchronized (this) {
if (connection != -1) {
try {
BoringSSL.SSL_cleanup(ssl);
Quiche.quiche_conn_free(connection);
engine.ctx.remove(engine);
release = true;
refCnt.release();
} finally {
connection = -1;
}
}
}
Source
Frequently Asked Questions
What is the QuicheQuicConnection class?
QuicheQuicConnection is a class in the netty codebase, defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicConnection.java.
Where is QuicheQuicConnection defined?
QuicheQuicConnection is defined in codec-classes-quic/src/main/java/io/netty/handler/codec/quic/QuicheQuicConnection.java at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free