Class SentPacket

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

public final class SentPacket extends Object
What loss recovery remembers about a sent packet until it is acknowledged or deemed lost (RFC 9002 appendix A.1.1). Stream data is not copied: streamFrames() only names the ranges.

Threads. Not thread-safe; owned by one connection.

  • Constructor Summary

    Constructors
    Constructor
    Description
    SentPacket(long timeSent, int size, boolean ackEliciting, long largestAcked, Retransmits retransmits, List<StreamMeta> streamFrames)
    A sent packet.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether the packet must be acknowledged.
    long
    The bytes the connection had delivered when this packet was sent (P.delivered).
    long
    When the connection's delivered count last changed before this packet was sent ( P.delivered_time).
    long
    The send time of the first packet of the flight this one was sent in ( P.first_sent_time).
    boolean
    Whether the packet was sent while sending was application limited ( P.is_app_limited).
    long
    The largest packet number the packet's ACK frame acknowledged.
    static SentPacket
    of(long timeSent, int size, boolean ackEliciting)
    A packet without frames to track, for tests and ACK-only packets.
    long
    The generation of the path the packet was sent on.
    The control frames the packet carried.
    int
    The bytes the packet counts in flight.
    The STREAM frames the packet carried.
    long
    When the packet was sent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SentPacket

      public SentPacket(long timeSent, int size, boolean ackEliciting, long largestAcked, Retransmits retransmits, List<StreamMeta> streamFrames)
      A sent packet.
      Parameters:
      timeSent - when it was sent, in nanoseconds
      size - its size in bytes, QUIC framing included but not UDP or IP; zero if it is not counted in flight (an ACK-only packet that is not padded)
      ackEliciting - whether it must be acknowledged
      largestAcked - the largest packet number its ACK frame acknowledged, or -1
      retransmits - the control frames it carried, to queue again if it is lost; may be null
      streamFrames - the STREAM frames it carried
  • Method Details

    • of

      public static SentPacket of(long timeSent, int size, boolean ackEliciting)
      A packet without frames to track, for tests and ACK-only packets.
      Parameters:
      timeSent - when it was sent
      size - its size, zero if not in flight
      ackEliciting - whether it must be acknowledged
      Returns:
      the packet
    • timeSent

      public long timeSent()
      When the packet was sent.
      Returns:
      nanoseconds
    • size

      public int size()
      The bytes the packet counts in flight.
      Returns:
      the size, zero if not in flight
    • ackEliciting

      public boolean ackEliciting()
      Whether the packet must be acknowledged.
      Returns:
      true if it carried a frame other than ACK, PADDING and CONNECTION_CLOSE
    • largestAcked

      public long largestAcked()
      The largest packet number the packet's ACK frame acknowledged.
      Returns:
      the packet number, or -1 if it carried no ACK
    • retransmits

      public Retransmits retransmits()
      The control frames the packet carried.
      Returns:
      the frames, or null if none
    • streamFrames

      public List<StreamMeta> streamFrames()
      The STREAM frames the packet carried.
      Returns:
      what each one carried
    • delivered

      public long delivered()
      The bytes the connection had delivered when this packet was sent (P.delivered).
      Returns:
      bytes
    • deliveredTime

      public long deliveredTime()
      When the connection's delivered count last changed before this packet was sent ( P.delivered_time).
      Returns:
      the time, or Long.MIN_VALUE if the packet was not in flight
    • firstSentTime

      public long firstSentTime()
      The send time of the first packet of the flight this one was sent in ( P.first_sent_time).
      Returns:
      the time, or Long.MIN_VALUE if the packet was not in flight
    • isAppLimited

      public boolean isAppLimited()
      Whether the packet was sent while sending was application limited ( P.is_app_limited).
      Returns:
      the flag
    • pathGeneration

      public long pathGeneration()
      The generation of the path the packet was sent on.
      Returns:
      the generation