Class Retransmits

java.lang.Object
io.github.mahmoudimus.quic.connection.Retransmits

public final class Retransmits extends Object
Control frames waiting to be sent in one packet number space, and, attached to a SentPacket, the control frames that packet carried, to queue again if it is lost.

Most entries record only that a frame is needed; its current value is computed when the packet is built, so a retransmission carries fresh limits (RFC 9000 section 13.3). Stream data itself is not here: it stays in the streams' SendBuffers.

This is a plain mutable holder of public fields. Threads: not thread-safe; owned by one connection.

  • Field Details

    • maxData

      public boolean maxData
      Whether a MAX_DATA is needed.
    • dataBlocked

      public boolean dataBlocked
      Whether a DATA_BLOCKED is needed.
    • maxStreamId

      public final boolean[] maxStreamId
      Whether a MAX_STREAMS is needed, indexed by Enum.ordinal().
    • streamsBlocked

      public final boolean[] streamsBlocked
      Whether a STREAMS_BLOCKED is needed, indexed by Enum.ordinal().
    • resetStream

      public final List<Retransmits.PendingReset> resetStream
      RESET_STREAM frames to send.
    • stopSending

      public final List<Frame.StopSending> stopSending
      STOP_SENDING frames to send.
    • maxStreamData

      public final Set<StreamId> maxStreamData
      Streams that need a MAX_STREAM_DATA.
    • streamDataBlocked

      public final Set<StreamId> streamDataBlocked
      Streams that need a STREAM_DATA_BLOCKED.
    • crypto

      public final ArrayDeque<Frame.Crypto> crypto
      CRYPTO frames to send, retransmissions first.
    • newCids

      public final List<IssuedCid> newCids
      NEW_CONNECTION_ID frames to send.
    • retireCids

      public final List<Long> retireCids
      Sequence numbers to retire in RETIRE_CONNECTION_ID frames.
    • ackFrequency

      public boolean ackFrequency
      Whether an ACK_FREQUENCY is needed.
    • handshakeDone

      public boolean handshakeDone
      Whether a HANDSHAKE_DONE is needed.
    • newTokens

      public final List<InetSocketAddress> newTokens
      One entry per NEW_TOKEN frame to send, holding the path's remote address: a lost token is replaced by a fresh one, and only for the path it was meant for.
  • Constructor Details

    • Retransmits

      public Retransmits()
      Nothing pending.
  • Method Details

    • retireCids

      public void retireCids(long start, long end) throws QuicException
      Queues RETIRE_CONNECTION_ID frames for a range of sequence numbers.
      Parameters:
      start - the first sequence number
      end - one past the last
      Throws:
      QuicException - CONNECTION_ID_LIMIT_ERROR if too many would be queued, which only a peer that keeps retiring connection IDs causes
    • isEmpty

      public boolean isEmpty(StreamsState streams)
      Whether nothing needs sending. Stream entries count only while still meaningful: a MAX_STREAM_DATA for a stream that no longer takes data, or a blocked frame whose limit the peer has since raised, does not.
      Parameters:
      streams - the connection's streams
      Returns:
      true if no frame is needed
    • merge

      public void merge(Retransmits other)
      Merges another set of pending frames into this one. CRYPTO frames from other go first, which reduces head-of-line blocking when they are retransmissions.
      Parameters:
      other - the frames to add; not changed