Class NewReno

java.lang.Object
io.github.mahmoudimus.quic.congestion.NewReno
All Implemented Interfaces:
Controller

public final class NewReno extends Object implements Controller
The NewReno congestion controller of RFC 9002 section 7: slow start, then congestion avoidance growing the window by one datagram per window acknowledged (Appropriate Byte Counting, RFC 3465), and a multiplicative decrease once per recovery period.

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

  • Constructor Details

    • NewReno

      public NewReno(NewRenoConfig config, long now, int currentMtu)
      A controller in slow start.
      Parameters:
      config - the configuration
      now - the current time, in nanoseconds
      currentMtu - the path's maximum UDP payload size
  • Method Details

    • onAck

      public void onAck(long now, long sent, long bytes, boolean appLimited, RttEstimator rtt)
      Description copied from interface: Controller
      A packet's delivery was confirmed.
      Specified by:
      onAck in interface Controller
      Parameters:
      now - the current time
      sent - when the packet was sent
      bytes - the packet's size
      appLimited - whether the connection was limited by the application, not the window, before these acknowledgements
      rtt - the path's RTT estimate
    • onCongestionEvent

      public void onCongestionEvent(long now, long sent, boolean persistentCongestion, boolean ecn, long lostBytes)
      Description copied from interface: Controller
      Packets were deemed lost, or marked with ECN congestion experienced.
      Specified by:
      onCongestionEvent in interface Controller
      Parameters:
      now - the current time
      sent - when the most recent lost packet was sent
      persistentCongestion - whether every packet in the persistent congestion period ending with that packet was lost (RFC 9002 section 7.6)
      ecn - whether this is an ECN signal rather than loss
      lostBytes - the bytes lost, zero for ECN
    • onMtuUpdate

      public void onMtuUpdate(int newMtu)
      Description copied from interface: Controller
      The path's MTU changed.
      Specified by:
      onMtuUpdate in interface Controller
      Parameters:
      newMtu - the new maximum UDP payload size
    • window

      public long window()
      Description copied from interface: Controller
      The congestion window.
      Specified by:
      window in interface Controller
      Returns:
      the ack-eliciting bytes that may be in flight
    • slowStartThreshold

      public long slowStartThreshold()
      The slow start threshold.
      Returns:
      bytes, Long.MAX_VALUE before the first congestion event
    • metrics

      public ControllerMetrics metrics()
      Description copied from interface: Controller
      Metrics for statistics and tracing.
      Specified by:
      metrics in interface Controller
      Returns:
      the window and, where known, the slow start threshold
    • copy

      public Controller copy()
      Description copied from interface: Controller
      A copy of the controller's state, for a new path that starts from this one.
      Specified by:
      copy in interface Controller
      Returns:
      an independent copy
    • initialWindow

      public long initialWindow()
      Description copied from interface: Controller
      The initial window.
      Specified by:
      initialWindow in interface Controller
      Returns:
      bytes