Commit ba3b6252 authored by jan.koester's avatar jan.koester
Browse files

test

parent 14f38323
Loading
Loading
Loading
Loading
+15 −3
Changes for src/quic.cpp: 15 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -498,9 +498,14 @@ void quic::onPacketAckedCC(size_t packet_size, uint64_t pn) {
    if (_cwnd < _ssthresh) {
        _cwnd += packet_size;
    } else {
        // Congestion avoidance: cwnd grows by ~1 MTU per RTT
        // Congestion avoidance: cwnd grows by ~1 MTU per RTT (RFC 9002
        // Appendix B.5). Uses the actual confirmed usable datagram size
        // (_max_udp_payload — 1472 until DPLPMTUD confirms a larger path
        // MTU) rather than a hardcoded 1472, so cwnd growth doesn't stay
        // capped at the Ethernet-safe baseline on paths where PMTU
        // discovery has since raised it (e.g. jumbo frames).
        // Approximation: cwnd += MTU * packet_size / cwnd
        _cwnd += (1472 * packet_size) / _cwnd;
        _cwnd += (_max_udp_payload * packet_size) / _cwnd;
    }
}

@@ -514,7 +519,14 @@ void quic::onPacketLostCC(size_t packet_size, uint64_t pn) {
    // Enter recovery if not already in it
    if (!_in_recovery || pn > _recovery_start_pn) {
        _in_recovery = true;
        _recovery_start_pn = _app_pn_send;
        // _app_pn_send is the *next*, not-yet-assigned PN — the marker
        // must be the last PN actually sent before this recovery episode
        // began, so that onPacketAckedCC()'s `pn <= _recovery_start_pn`
        // exit check correctly treats the very first packet sent *during*
        // recovery (which gets PN == that next value) as eligible to end
        // it, instead of requiring one further packet/ACK first (RFC 9002
        // §7.3.2: recovery ends on an ACK for any packet sent during it).
        _recovery_start_pn = (_app_pn_send > 0) ? (_app_pn_send - 1) : 0;
        // Multiplicative decrease
        _ssthresh = std::max(_cwnd / 2, MIN_CWND);
        _cwnd = _ssthresh;