Class DeliveryRate
java.lang.Object
io.github.mahmoudimus.quic.connection.DeliveryRate
Delivery rate estimation as draft-cheng-iccrg-delivery-rate-estimation describes it, the
sampler BBR is built on. Each packet sent in flight is stamped with the connection's delivered
bytes, the time they were last updated, the send time of the packet that started the current
flight and whether sending was application limited; acknowledging packets yields one sample
per ACK, from the newest packet acknowledged. quinn has no such sampler: its BBR estimates the
rate from per-packet send and ACK intervals.
Times are nanoseconds. Threads. Not thread-safe; owned by one connection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongThe bytes delivered on the connection so far.booleanWhether packets sent now are marked application limited.voidonAppLimited(long bytesInFlight) Records that sending is application limited: samples from packets sent until the bytes now in flight are delivered are marked application limited.voidonPacketAcked(long now, SentPacket packet) Records an acknowledged packet that was stamped byonPacketSent(long, io.github.mahmoudimus.quic.connection.SentPacket, long).voidonPacketSent(long now, SentPacket packet, long bytesInFlight) Stamps a packet about to go in flight.sample(long minRtt) Ends an ACK: the sample of the packets it acknowledged.
-
Constructor Details
-
DeliveryRate
public DeliveryRate()A sampler for a connection that has delivered nothing yet.
-
-
Method Details
-
onPacketSent
Stamps a packet about to go in flight.- Parameters:
now- the current timepacket- the packetbytesInFlight- the bytes in flight before it
-
onAppLimited
public void onAppLimited(long bytesInFlight) Records that sending is application limited: samples from packets sent until the bytes now in flight are delivered are marked application limited.- Parameters:
bytesInFlight- the bytes in flight
-
onPacketAcked
Records an acknowledged packet that was stamped byonPacketSent(long, io.github.mahmoudimus.quic.connection.SentPacket, long).- Parameters:
now- the current timepacket- the packet
-
sample
Ends an ACK: the sample of the packets it acknowledged.- Parameters:
minRtt- the path's minimum RTT, or 0 if unknown; a sample over a shorter interval has no rate, as the draft says, since an ACK compressed in time would overstate it- Returns:
- the sample, or null if the ACK acknowledged nothing in flight
-
delivered
public long delivered()The bytes delivered on the connection so far.- Returns:
- bytes
-
isAppLimited
public boolean isAppLimited()Whether packets sent now are marked application limited.- Returns:
- true until the application-limited bytes are delivered
-