Commit 435b463a authored by jan.koester's avatar jan.koester
Browse files

test

parent b8d339ef
Loading
Loading
Loading
Loading
+12 −7
Changes for src/quic.cpp: 12 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -3506,7 +3506,10 @@ void quic::sendStreamData(uint64_t stream_id, const std::vector<uint8_t>& data,
    // STREAM frame header: 1 (type) + varint(stream_id) + varint(offset) + varint(length)
    // Conservative estimate for frame header (stream_id < 64 → 1 byte, etc.)
    const size_t frame_hdr_max = 1 + 8 + 8 + 8;  // worst case varints
    const size_t max_datagram = 1200;
    // Post-handshake packets can use larger datagrams than the 1200-byte
    // minimum required for Initial packets.  1350 fits well within
    // typical Ethernet MTU (1500 - 20 IP - 8 UDP = 1472 max).
    const size_t max_datagram = _handshake_complete ? 1350 : 1200;
    // Usable payload per packet (conservative)
    const size_t max_stream_data = max_datagram - header_overhead - frame_hdr_max;

@@ -3527,7 +3530,9 @@ void quic::sendStreamData(uint64_t stream_id, const std::vector<uint8_t>& data,
    // client process data and send MAX_STREAM_DATA / MAX_DATA updates.
    // Without this, burst-sending hundreds of packets causes packet loss
    // and the client never increases the FC window.
    static constexpr size_t PACE_INTERVAL = 10;
    // Use a larger burst (64 packets) with a shorter sleep (50µs) to
    // improve throughput for large transfers while still yielding.
    static constexpr size_t PACE_INTERVAL = 64;

    while (buf_offset < data.size()) {
        // Bail out early if the connection was closed/draining while we waited
@@ -3600,7 +3605,7 @@ void quic::sendStreamData(uint64_t stream_id, const std::vector<uint8_t>& data,
                // Release the mutex during sleep so other connections
                // sharing this listener are not starved.
                lock.unlock();
                std::this_thread::sleep_for(std::chrono::microseconds(200));
                std::this_thread::sleep_for(std::chrono::microseconds(50));
                lock.lock();

                // Re-check connection state after re-acquiring lock
@@ -4465,10 +4470,10 @@ size_t quic::sendData(buffer& data, int flags) {
        }
    }
    
    // Build STREAM frames in 1200-byte datagram chunks (QUIC MTU)
    // Build STREAM frames in QUIC datagram chunks
    const size_t header_overhead = 1 + _remote_cid.size() + 4 + 16;
    const size_t frame_hdr_max = 1 + 8 + 8 + 8;
    const size_t max_datagram = 1200;
    const size_t max_datagram = _handshake_complete ? 1350 : 1200;
    const size_t max_chunk = max_datagram - header_overhead - frame_hdr_max;

    size_t sent_total = 0;
@@ -4543,10 +4548,10 @@ size_t quic::sendStreamData(uint64_t stream_id, const uint8_t* data, size_t len,
        return 0;
    }
    
    // Chunk into 1200-byte QUIC datagrams for proper MTU handling
    // Chunk into QUIC datagrams for proper MTU handling
    const size_t header_overhead = 1 + _remote_cid.size() + 4 + 16;
    const size_t frame_hdr_max = 1 + 8 + 8 + 8;
    const size_t max_datagram = 1200;
    const size_t max_datagram = _handshake_complete ? 1350 : 1200;
    const size_t max_chunk = max_datagram - header_overhead - frame_hdr_max;

    size_t sent_total = 0;