Class DeliveryRate

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

public final class DeliveryRate extends Object
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 Details

    • DeliveryRate

      public DeliveryRate()
      A sampler for a connection that has delivered nothing yet.
  • Method Details

    • onPacketSent

      public void onPacketSent(long now, SentPacket packet, long bytesInFlight)
      Stamps a packet about to go in flight.
      Parameters:
      now - the current time
      packet - the packet
      bytesInFlight - 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

      public void onPacketAcked(long now, SentPacket packet)
      Records an acknowledged packet that was stamped by onPacketSent(long, io.github.mahmoudimus.quic.connection.SentPacket, long).
      Parameters:
      now - the current time
      packet - the packet
    • sample

      public RateSample sample(long minRtt)
      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