Commit 1024619b authored by jan.koester's avatar jan.koester
Browse files

test

parent cc9ae527
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
@@ -43,7 +43,12 @@
#include <cstdio>
#include <cmath>

#define QUIC_DBG(fmt, ...) do { } while(0)
#define QUIC_DBG(fmt, ...) do { \
    if (getenv("QUIC_TRACE")) { \
        fprintf(stderr, "[%.6f] " fmt "\n", \
                std::chrono::duration<double>(std::chrono::steady_clock::now().time_since_epoch()).count(), ##__VA_ARGS__); \
    } \
} while(0)

namespace netplus {

@@ -1587,9 +1592,9 @@ void quic::sendRetryPacket(const std::vector<uint8_t>& client_dcid,
    auto tag = computeRetryIntegrityTag(client_dcid, packet.data(), packet.size());
    packet.insert(packet.end(), tag.begin(), tag.end());

    sendBatch({{packet.data(), packet.size()}}, &peer_addr, peer_len);
    QUIC_DBG("sendRetryPacket: client_dcid_len=%zu retry_scid_len=%zu packet_len=%zu",
             client_dcid.size(), retry_scid.size(), packet.size());
    ssize_t sent = sendBatch({{packet.data(), packet.size()}}, &peer_addr, peer_len);
    QUIC_DBG("sendRetryPacket: client_dcid_len=%zu retry_scid_len=%zu packet_len=%zu sent=%zd errno=%d",
             client_dcid.size(), retry_scid.size(), packet.size(), sent, sent < 0 ? errno : 0);
}

void quic::sendVersionNegotiation(const std::vector<uint8_t>& client_dcid,
@@ -1630,9 +1635,9 @@ void quic::sendVersionNegotiation(const std::vector<uint8_t>& client_dcid,
    pushVersion(QUIC_VERSION_2);
    pushVersion(0x1a2a3a4a); // reserved version pattern, RFC 9000 §15.3

    sendBatch({{packet.data(), packet.size()}}, &peer_addr, peer_len);
    QUIC_DBG("sendVersionNegotiation: client_dcid_len=%zu client_scid_len=%zu packet_len=%zu",
             client_dcid.size(), client_scid.size(), packet.size());
    ssize_t sent = sendBatch({{packet.data(), packet.size()}}, &peer_addr, peer_len);
    QUIC_DBG("sendVersionNegotiation: client_dcid_len=%zu client_scid_len=%zu packet_len=%zu sent=%zd errno=%d",
             client_dcid.size(), client_scid.size(), packet.size(), sent, sent < 0 ? errno : 0);
}

// ============================================================================