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

timings quic

parent 0c82ebf3
Loading
Loading
Loading
Loading
+12 −1
Changes for src/quic.cpp: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5817,7 +5817,18 @@ size_t quic::sendStreamData(uint64_t stream_id, const uint8_t* data, size_t len,
            // a fresh one per ~1ms attempt — see _cc_socketwait's comment.
            if (!unblocked) {
                if (!_cc_socketwait) _cc_socketwait = std::make_unique<socketwait>();
                for (int cc_wait = 0; cc_wait < 100; ++cc_wait) {
                // Budget the wait off the connection's own RTO estimate
                // (RFC 9002 §6.2) instead of a flat 100ms. A fixed 100ms
                // cap gave up before the cwnd realistically had time to
                // open under the RFC-9002 initial cwnd, forcing the final
                // chunk of larger transfers onto slow PTO-based
                // retransmission (measured 1.2-1.3s spikes vs 85-250ms
                // baseline). Floor at 100ms to match prior behavior on
                // healthy connections; cap at 2s so a blown-up RTO
                // estimate can't stall the sender indefinitely.
                int cc_wait_budget_ms = static_cast<int>(
                    std::clamp(_rto * 1000.0, 100.0, 2000.0));
                for (int cc_wait = 0; cc_wait < cc_wait_budget_ms; ++cc_wait) {
                    if (_conn_state.load() == ConnectionState::Closed ||
                        _conn_state.load() == ConnectionState::Draining) break;
                    lock.unlock();