Class SentPackets

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

public final class SentPackets extends Object
The sent packets of one packet number space that are neither acknowledged nor lost, by packet number. Storage depends on the number of packets tracked, not on the distance between their numbers.

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

  • Constructor Details

    • SentPackets

      public SentPackets()
      No packets.
  • Method Details

    • insert

      public void insert(long pn, SentPacket packet)
      Adds a packet, whose number must exceed every number added before.
      Parameters:
      pn - the packet number
      packet - the packet
      Throws:
      IllegalArgumentException - if pn does not increase
    • remove

      public SentPacket remove(long pn)
      Removes a packet.
      Parameters:
      pn - the packet number
      Returns:
      the packet, or null if it was not tracked
    • get

      public SentPacket get(long pn)
      A packet.
      Parameters:
      pn - the packet number
      Returns:
      the packet, or null if not tracked
    • hasInFlight

      public boolean hasInFlight()
      Whether any tracked packet counts in flight.
      Returns:
      true if one has a nonzero size
    • range

      public NavigableMap<Long,SentPacket> range(long from, long to)
      The packets numbered [from, to), in increasing order.
      Parameters:
      from - the first packet number
      to - one past the last packet number
      Returns:
      a live view
    • higher

      public Map.Entry<Long,SentPacket> higher(long pn)
      The first packet numbered above pn.
      Parameters:
      pn - the packet number
      Returns:
      the entry, or null
    • values

      public Collection<SentPacket> values()
      Every packet, in increasing order.
      Returns:
      a live view
    • size

      public int size()
      The number of packets tracked.
      Returns:
      the count
    • clear

      public Collection<SentPacket> clear()
      Removes every packet.
      Returns:
      the packets removed, in increasing order