feed ECN feedback into the congestion controller

This commit is contained in:
Marten Seemann 2023-09-02 09:26:49 +07:00
parent 797e275293
commit d6ac6300a4
5 changed files with 251 additions and 6 deletions

View file

@ -93,7 +93,7 @@ type sentPacketHandler struct {
alarm time.Time
enableECN bool
ecnTracker *ecnTracker
ecnTracker ecnHandler
perspective protocol.Perspective
@ -346,17 +346,16 @@ func (h *sentPacketHandler) ReceivedAck(ack *wire.AckFrame, encLevel protocol.En
}
}
var ecnCongestionDetected bool
// Only inform the ECN tracker about new 1-RTT ACKs if the ACK increases the largest acked.
if encLevel == protocol.Encryption1RTT && h.ecnTracker != nil && largestAcked > pnSpace.largestAcked {
ecnCongestionDetected = h.ecnTracker.HandleNewlyAcked(ackedPackets, int64(ack.ECT0), int64(ack.ECT1), int64(ack.ECNCE))
congested := h.ecnTracker.HandleNewlyAcked(ackedPackets, int64(ack.ECT0), int64(ack.ECT1), int64(ack.ECNCE))
if congested {
h.congestion.OnCongestionEvent(largestAcked, 0, priorInFlight)
}
}
pnSpace.largestAcked = utils.Max(pnSpace.largestAcked, largestAcked)
// TODO: inform the congestion controller
_ = ecnCongestionDetected
if err := h.detectLostPackets(rcvTime, encLevel); err != nil {
return false, err
}