Class QuicheTripTransport

java.lang.Object
org.tentackle.trip.transport.AbstractTransport
org.tentackle.quiche.QuicheTripTransport
All Implemented Interfaces:
Transport
Direct Known Subclasses:
CompressedQuicheTripTransport

@TransportService("tripj") public class QuicheTripTransport extends AbstractTransport
Transport implementation for QUIC on top of Cloudflare quiche.

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.

  • Field Details

    • PROTOCOL

      public static final String PROTOCOL
      The protocol name for QUIC over quiche.
      See Also:
    • DEFAULT_MAX_IDLE_SECONDS

      public static final int DEFAULT_MAX_IDLE_SECONDS
      The default QUIC max idle timeout in seconds, applied if the URI does not specify quicidle.
      See Also:
    • DEFAULT_MAX_STREAMS

      public static final int DEFAULT_MAX_STREAMS
      The default maximum number of concurrent peer-initiated bidirectional streams, applied if the URI does not specify maxstreams.
      See Also:
    • DEFAULT_STREAM_WINDOW

      public static final int DEFAULT_STREAM_WINDOW
      The default flow control window per stream in bytes, applied if the URI does not specify streamwindow.
      See Also:
    • CONNECTION_WINDOW_FACTOR

      public static final int CONNECTION_WINDOW_FACTOR
      The 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 streamwindow so 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_WINDOW
      The smallest flow control window accepted for streamwindow.

      A window must hold at least one maximum-sized QUIC packet.

      See Also:
  • Constructor Details

    • QuicheTripTransport

      public QuicheTripTransport(URI uri)
      Creates a new QUIC transport.
      Parameters:
      uri - the URI of the transport
  • Method Details

    • accept

      public void accept()
      Description copied from interface: Transport
      Accepts connections from clients.
      Specified by:
      accept in interface Transport
      Overrides:
      accept in class AbstractTransport
    • isAccepting

      public boolean isAccepting()
      Description copied from interface: Transport
      Returns true if this transport is accepting connections.
      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 idle parameter, 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 (see QuicheTripConnectionPool).
      Returns:
      the maximum number of streams, always ≥ 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). 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, see CONNECTION_WINDOW_FACTOR.
      Returns:
      the window in bytes
    • 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 waits for the client connections to terminate, which is why it happens outside the transport's monitor: connection handlers still running must be able to invoke synchronized transport methods.

      Specified by:
      close in interface Transport
      Overrides:
      close in class AbstractTransport
    • createClientConnectionPool

      protected Pool<Connection> createClientConnectionPool()
      Description copied from class: AbstractTransport
      Creates the connection pool for outgoing connections.
      Specified by:
      createClientConnectionPool in class AbstractTransport
      Returns:
      the connection pool