Class SentPackets
java.lang.Object
io.github.mahmoudimus.quic.connection.SentPackets
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclear()Removes every packet.get(long pn) A packet.booleanWhether any tracked packet counts in flight.higher(long pn) The first packet numbered abovepn.voidinsert(long pn, SentPacket packet) Adds a packet, whose number must exceed every number added before.range(long from, long to) The packets numbered[from, to), in increasing order.remove(long pn) Removes a packet.intsize()The number of packets tracked.values()Every packet, in increasing order.
-
Constructor Details
-
SentPackets
public SentPackets()No packets.
-
-
Method Details
-
insert
Adds a packet, whose number must exceed every number added before.- Parameters:
pn- the packet numberpacket- the packet- Throws:
IllegalArgumentException- ifpndoes not increase
-
remove
Removes a packet.- Parameters:
pn- the packet number- Returns:
- the packet, or null if it was not tracked
-
get
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
The packets numbered[from, to), in increasing order.- Parameters:
from- the first packet numberto- one past the last packet number- Returns:
- a live view
-
higher
The first packet numbered abovepn.- Parameters:
pn- the packet number- Returns:
- the entry, or null
-
values
Every packet, in increasing order.- Returns:
- a live view
-
size
public int size()The number of packets tracked.- Returns:
- the count
-
clear
Removes every packet.- Returns:
- the packets removed, in increasing order
-