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

rtt bugfix

parent b25e9b64
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -7174,7 +7174,17 @@ size_t quic::sendStreamData(uint64_t stream_id, const uint8_t* data, size_t len,
        return sendStreamDataEarly(stream_id, data, len, fin);
    }

    if (_conn_state.load() != ConnectionState::Connected && !_handshake_complete) {
    // RFC 9001 §4.1.1: a server MAY send 1-RTT packets as soon as it has
    // sent its own Finished — it doesn't need to wait for (or verify) the
    // client's Finished first, i.e. _handshake_complete (which this server
    // only sets upon receiving the *client's* Finished) is stricter than
    // the RFC requires. Without this, a server that accepted 0-RTT could
    // decrypt a client's early data (processZeroRTTPacket() already derives
    // _app_keys by then, via processClientHello() -> sendServerHello() ->
    // sendServerHandshakeFlight()) but could never reply to it early,
    // defeating the entire point of accepting 0-RTT in the first place.
    bool server_app_keys_ready = _is_server && _app_keys.send.aes_gcm != nullptr;
    if (_conn_state.load() != ConnectionState::Connected && !_handshake_complete && !server_app_keys_ready) {
        return 0;
    }