Class QuicheTripTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
CompressedQuicheTripTransport
This is the sibling of tentackle-quic, which provides the same transport on top of KWIK. Both
speak RFC-9000 and interoperate; they register different URI schemes so that an application can use
either, or both at once, and pick per connection. The URI parameters are described in the module's
documentation (quiche.md).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of connection IDs each side is willing to hold for the peer, including the one in use.static final intThe factor by which the connection's flow control window exceeds the window of a single stream.static final intThe default QUIC max idle timeout in seconds, applied if the URI does not specifyquicidle.static final intThe default maximum number of concurrent peer-initiated bidirectional streams, applied if the URI does not specifymaxstreams.static final intThe default number of consecutive probe timeouts without any acknowledgment after which a client migrates its QUIC connection to a new source port, applied if the URI does not specifymigrate.static final intThe default flow control window per stream in bytes, applied if the URI does not specifystreamwindow.static final intThe smallest flow control window accepted forstreamwindow.static final StringThe protocol name for QUIC over quiche. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept()Accepts connections from clients.
Puts the transport into server mode.voidclose()Closes this transport.protected Pool<Connection> Creates the connection pool for outgoing connections.Gets the client-certificate policy of the accepting transport.intGets the QUIC max idle timeout in seconds.
A QUIC connection is discarded silently by both peers when it stays idle for longer than the minimum of the timeouts of both peers (see RFC-9000, 10.1).intGets the maximum number of concurrent peer-initiated bidirectional streams per QUIC connection.
On the server this is the limit advertised to the clients.intGets after how many consecutive probe timeouts without any acknowledgment a client migrates its QUIC connection to a new source port.
Some networks hash each flow onto one of several paths by its addresses and ports, and a flow that lands on a path that stopped delivering stays stuck there, whereas a new source port puts it onto another one.intGets the flow control window per stream in bytes.
A peer may send at most that many bytes on a stream before the receiving side has to grant further credits (see RFC-9000, 4).booleanReturns true if this transport is accepting connections.protected RunnableDetaches the QUIC endpoint from this transport, the first step ofclose().Methods inherited from class AbstractTransport
createCallHandler, createConnectionHandler, createRegistry, createServerThread, getCallThreadPool, getClientDictionary, getConnection, getConnectionThreadPool, getId, getPreAuthenticationPolicy, getRegistry, getRemoteLookup, getServerDictionary, getTransportKey, getUri, getUriPars, isClosed, lookup, putConnection, setPreAuthenticationPolicy, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Transport
createConnectionHandler
-
Field Details
-
PROTOCOL
-
DEFAULT_MAX_IDLE_SECONDS
public static final int DEFAULT_MAX_IDLE_SECONDSThe default QUIC max idle timeout in seconds, applied if the URI does not specifyquicidle.- See Also:
-
DEFAULT_MAX_STREAMS
public static final int DEFAULT_MAX_STREAMSThe default maximum number of concurrent peer-initiated bidirectional streams, applied if the URI does not specifymaxstreams.- See Also:
-
DEFAULT_STREAM_WINDOW
public static final int DEFAULT_STREAM_WINDOWThe default flow control window per stream in bytes, applied if the URI does not specifystreamwindow.- See Also:
-
CONNECTION_WINDOW_FACTOR
public static final int CONNECTION_WINDOW_FACTORThe factor by which the connection's flow control window exceeds the window of a single stream.The connection window must be larger than the stream window, or both limits would be exhausted at the very same offset and every transfer would proceed in lockstep with the credit updates. Keeping the connection window a multiple of the stream window makes the stream limit the binding one.
Note that the connection window is shared by all streams of the connection, so the stream limit is the binding one only as long as fewer than this many streams transfer at full window at the same time. Sizing
streamwindowso that ordinary calls fit into it keeps the number of streams that are blocked on flow control small.- See Also:
-
MIN_STREAM_WINDOW
public static final int MIN_STREAM_WINDOWThe smallest flow control window accepted forstreamwindow.A window must hold at least one maximum-sized QUIC packet.
- See Also:
-
DEFAULT_MIGRATION_PROBE_TIMEOUTS
public static final int DEFAULT_MIGRATION_PROBE_TIMEOUTSThe default number of consecutive probe timeouts without any acknowledgment after which a client migrates its QUIC connection to a new source port, applied if the URI does not specifymigrate.Two is the smallest number that tells a stalled path from a single burst of losses: the first probe timeout alone fires on an ordinary lost tail, the second one means that not even the probe got through. Since the probe timeout backs off exponentially, two of them take about three times the first one, i.e., a few round trip times.
- See Also:
-
ACTIVE_CONNECTION_ID_LIMIT
public static final int ACTIVE_CONNECTION_ID_LIMITThe number of connection IDs each side is willing to hold for the peer, including the one in use.Every migration needs a spare connection ID of the peer, and quiche keeps the network paths a connection has used for as long as they have connection IDs, so this also bounds how often a connection can migrate. A connection that cannot migrate any further stays where it is, and if its path does not recover, it runs into the idle timeout and the pool re-establishes it from a fresh source port.
- See Also:
-
-
Constructor Details
-
QuicheTripTransport
Creates a new QUIC transport.- Parameters:
uri- the URI of the transport
-
-
Method Details
-
getClientAuth
Gets the client-certificate policy of the accepting transport.- Returns:
- the policy,
SslParameters.ClientAuth.NONEif not accepting or no certificates are requested
-
accept
public void accept()Description copied from interface:TransportAccepts connections from clients.
Puts the transport into server mode.- Specified by:
acceptin interfaceTransport- Overrides:
acceptin classAbstractTransport
-
isAccepting
public boolean isAccepting()Returns true if this transport is accepting connections.False as well once the endpoint closed itself because its event loop failed.
- Returns:
- true if accepting, false otherwise
-
getMaxIdleSeconds
public int getMaxIdleSeconds()Gets the QUIC max idle timeout in seconds.
A QUIC connection is discarded silently by both peers when it stays idle for longer than the minimum of the timeouts of both peers (see RFC-9000, 10.1). The same value is configured on the server and on the client, so that the effective timeout is well-defined.Note that this has nothing to do with the
idleparameter, which is the timeout in minutes after which the connection pool closes unused connections.- Returns:
- the timeout in seconds
-
getMaxStreams
public int getMaxStreams()Gets the maximum number of concurrent peer-initiated bidirectional streams per QUIC connection.
On the server this is the limit advertised to the clients. On the client it bounds the size of the connection pool, since every pooled connection holds one stream for as long as it is in the pool (seeQuicheTripConnectionPool).- Returns:
- the maximum number of streams, always ≥ 1
- Throws:
TripRuntimeException- if the configured value is < 1
-
getStreamWindow
public int getStreamWindow()Gets the flow control window per stream in bytes.
A peer may send at most that many bytes on a stream before the receiving side has to grant further credits (see RFC-9000, 4). It is configured on both ends: on the server it applies to the data a client sends, i.e., to the size of the remote calls, and on the client to the size of the responses. The window should be at least as large as the largest call to be transferred without intermediate credit updates. The connection window is a multiple of it, seeCONNECTION_WINDOW_FACTOR.- Returns:
- the window in bytes
- Throws:
TripRuntimeException- if the configured window is smaller thanMIN_STREAM_WINDOW
-
getMigrationProbeTimeouts
public int getMigrationProbeTimeouts()Gets after how many consecutive probe timeouts without any acknowledgment a client migrates its QUIC connection to a new source port.
Some networks hash each flow onto one of several paths by its addresses and ports, and a flow that lands on a path that stopped delivering stays stuck there, whereas a new source port puts it onto another one. QUIC can move a connection without disturbing its streams (RFC-9000, 9).- Returns:
- the number of probe timeouts, 0 if the client never migrates
- Throws:
TripRuntimeException- if the configured value is < 0
-
close
public void close()Closes this transport.Overridden to shut down the QUIC endpoint, which releases the UDP socket and terminates the connections of all clients.
The endpoint is closed before the transport's thread pools are shut down, so that no incoming stream is dispatched to a pool that is already gone. Closing it sends every client a
CONNECTION_CLOSEand waits up to a second for the event loop to stop, which is why it happens outside the transport's monitor: connection handlers still running must be able to invoke synchronized transport methods.- Specified by:
closein interfaceTransport- Overrides:
closein classAbstractTransport
-
stopAccepting
Detaches the QUIC endpoint from this transport, the first step ofclose().From then on
accept()fails. Since the endpoint is closed outside the transport's monitor and the transport is marked closed only afterward, anaccept()getting in between would otherwise start an endpoint that nobody closes anymore.- Returns:
- the action closing what was detached, to be run without holding the transport's monitor
-
createClientConnectionPool
Description copied from class:AbstractTransportCreates the connection pool for outgoing connections.- Specified by:
createClientConnectionPoolin classAbstractTransport- Returns:
- the connection pool
-