persistentCongestion method

bool persistentCongestion(
  1. List<UDXPacket> lost
)

Whether lost, as just declared, is persistent congestion (RFC 9002 section 7.6): the sender has an RTT sample, the newest lost packet went out at least three PTOs after the oldest, and nothing was acknowledged between the oldest going out and the ACK (or timer) that revealed the loss. The socket then collapses the window.

Implementation

bool persistentCongestion(List<UDXPacket> lost) {
  if (lost.length < 2 || !congestionController.hasRttSample) return false;
  final oldest = lost.first.lastSentTime;
  final newest = lost.last.lastSentTime;
  if (oldest == null || newest == null) return false;
  if (newest - oldest < congestionController.persistentCongestionDuration) return false;
  final before = _ackBeforeLoss;
  return before == null || before < oldest;
}