The read event or write event are triggered by the selector thread. When the read event is triggered, all available datagrams are read from the channel and pushed into a read queue. Then the readLoop is triggered. When the write event is triggered, the key interestOps are modified to pause write events, and the writeLoop is triggered.
The readLoop and writeLoop should never execute on the selector thread, but rather, in the client's executor.
When the writeLoop is triggered, it polls the writeQueue and writes as many datagram as it can to the channel. At the end, if there still remains some datagrams in the writeQueue, the write event is resumed. Otherwise, the writeLoop is next triggered when new datagrams are added to the writeQueue.
When the readLoop is triggered, it polls the read queue and attempts to match each received packet with a QuicConnection. If no connection matches, it attempts to match the packet with stateless reset tokens. If no stateless reset token match, the packet is discarded.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | QuicEndpoint.
An enum identifying the type of channels used and supported by QuicEndpoint and QuicSelector |
| pack-priv abstract class | QuicEndpoint.
Represent a closing or draining quic connection: if we receive any packet for this connection we ignore them (if in draining state) or replay the closed packets in decreasing frequency: we reply to the first packet, then to the third, then to the seventh, etc... |
| pack-priv class | QuicEndpoint.
Represent a closing quic connection: if we receive any packet for this connection we simply replay the packet(s) that contained the ConnectionCloseFrame frame. |
| public static interface | QuicEndpoint.
This interface represent a UDP Datagram. |
| pack-priv class | QuicEndpoint.
Represent a draining quic connection: if we receive any packet for this connection we simply ignore them. |
| public static record | QuicEndpoint.
An outgoing datagram, or an incoming datagram for which a connection was identified. |
| public static class | |
| pack-priv static class | QuicEndpoint.
A |
| pack-priv static class | QuicEndpoint.
A |
| public static record | QuicEndpoint.
A stateless reset that should be sent in response to an incoming datagram targeted at a deleted connection. |
| public static record | QuicEndpoint.
An incoming datagram containing a stateless reset |
| private static record | |
| public static record | QuicEndpoint.
An incoming UDP Datagram for which no connection was found. |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final DatagramChannel | |
| private volatile boolean | |
| public static final QuicEndpoint. | CONFIGURED_CHANNEL_TYPE
The configured channel type |
| private final ConcurrentMap | |
| pack-priv final Logger | |
| pack-priv static final boolean | |
| pack-priv final Executor | |
| pack-priv volatile boolean | |
| private final QuicConnectionIdFactory | |
| private static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| private final String | |
| private final ConcurrentMap | |
| private final QuicInstance | |
| pack-priv volatile boolean | |
| pack-priv final SequentialScheduler | |
| pack-priv final ConcurrentLinkedQueue | |
| private final ByteBuffer | |
| pack-priv final QuicTimerQueue | |
| private final Key | |
| private static final boolean | |
| pack-priv static final Utils. | |
| pack-priv final SequentialScheduler | |
| pack-priv final ConcurrentLinkedQueue |
| Access | Constructor and Description |
|---|---|
| private | QuicEndpoint(QuicInstance quicInstance, DatagramChannel channel, String name, QuicTimerQueue timerQueue)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| pack-priv void | |
| public boolean | Returns: true if connection ID was added, false otherwisethe connection ID to be added cid, QuicPacketReceiver the connection that should be mapped to the cid connection)Add the cid to connection mapping to the endpoint. |
| private static Stream | |
| private static ByteBuffer | |
| pack-priv void | associateStatelessResetToken(final byte[]
the peer issued (16 byte) stateless reset token statelessResetToken, final QuicPacketReceiver the connection to link the token against connection)A peer issues a stateless reset token which it can then send to close the connection. |
| public int | |
| public int | |
| pack-priv boolean | |
| public DatagramChannel | |
| pack-priv void | |
| protected abstract QuicEndpoint. | |
| protected QuicPacketReceiver | Returns: connection associated with the stateless token, ornullthe sender's address source, final ByteBuffer datagram contents buffer)checks if the received datagram contains a stateless reset token; returns the associated connection if true, null otherwise |
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| pack-priv void | |
| protected void | |
| public final int | |
| private ByteBuffer | |
| private static < the concrete endpoint type, one of T extends QuicEndpoint> TQuicSelectableEndpoint
or QuicVirtualThreadedEndpoint | create(Class<T>
the concrete endpoint type, one of endpointType, QuicInstance QuicSelectableEndpoint. or QuicVirtualThreadedEndpoint..the quic instance quicInstance, String the endpoint name name, SocketAddress the address to bind to bindAddress, QuicTimerQueue the timer queue timerQueue)Returns a new |
| public abstract void | |
| private void | |
| public void | |
| private void | |
| pack-priv QuicPacketReceiver | |
| pack-priv boolean | |
| pack-priv void | forgetStatelessResetToken(final byte[]
The stateless reset token statelessResetToken)Discard the stateless reset token that this endpoint might have previously
|
| public SocketAddress | |
| public String | |
| pack-priv int | |
| public QuicConnectionIdFactory | |
| public boolean | |
| private boolean | |
| pack-priv boolean | |
| private boolean | |
| private QuicEndpoint. | |
| private QuicEndpoint. | Returns: aDatagram to be processed by the read loop
if a match is found, or null if the datagram can be dropped
immediatelythe source address source, ByteBuffer the incoming datagram payload buffer)This method tries to figure out whether the received packet matches a connection, or a stateless reset. |
| public String | |
| private void | |
| pack-priv void | |
| pack-priv abstract void | |
| private ByteBuffer | |
| public void | pushClosedDatagram(QuicConnectionImpl
the connection being closed connection, InetSocketAddress the peer address destination, ByteBuffer the datagram datagram)Called to schedule sending of a datagram that contains a single |
| public void | pushClosingDatagram(QuicConnectionImpl
the connection being closed connection, InetSocketAddress the peer address destination, ByteBuffer the datagram datagram)Called to schedule sending of a datagram that contains a |
| public void | pushDatagram(QuicPacketReceiver
the source connection source, SocketAddress the destination address destination, ByteBuffer the encrypted datagram payload)Schedule a datagram for writing to the underlying channel. |
| private void | |
| pack-priv boolean | |
| pack-priv void | |
| public void | |
| public static void | registerWithSelector(QuicEndpoint
the endpoint endpoint, QuicSelector<?> the selector selector, Logger a logger for debugging debug)Registers the given endpoint with the given selector. |
| private QuicEndpoint. | remapClosing(QuicConnectionId id, QuicPacketReceiver conn, QuicEndpoint.
|
| private QuicEndpoint. | remapDraining(QuicConnectionId id, QuicPacketReceiver conn, QuicEndpoint.
|
| private void | |
| pack-priv void | removeConnection(final QuicPacketReceiver
the connection to be removed connection)This will completely remove the connection from the endpoint. |
| public boolean | Returns: true if connection ID was removed, false otherwisethe connection ID to be removed cid, QuicPacketReceiver the connection that is mapped to the cid connection)Remove the cid to connection mapping from the endpoint. |
| pack-priv abstract void | |
| private int | |
| private void | |
| pack-priv boolean | |
| private void | |
| public QuicTimerQueue | Returns: the timer queue associated with this endpointReturns the timer queue associated with this endpoint. |
| protected TimeLine | Returns: the time source associated with this endpointReturns the time source associated with this endpoint. |
| public String | |
| public int | |
| protected void | unmatchedQuicPacket(QuicEndpoint.
The datagram containing the packet datagram,The quic packet type headersType,A buffer positioned at the start of the unmatched quic packet.
The buffer may contain more coalesced quic packets. buffer)Called when parsing a quic packet that couldn't be matched to any registered connection. |
| pack-priv void | |
| private void | |
| pack-priv Executor |