Use WriteOrBufferDataAtLevel to send crypto data. Such that existing WriteOrBufferData is used to send application data.
Change SendHandshakeMessage to take encryption level instead of using current default encryption level.
Protected by FLAGS_quic_reloadable_flag_quic_use_write_or_buffer_data_at_level.
PiperOrigin-RevId: 339927045
Change-Id: Ifa17962e5f70e6d4ed2d5aa8627150872f5dd69d
diff --git a/quic/core/quic_crypto_handshaker.cc b/quic/core/quic_crypto_handshaker.cc
index d608ead..8adf83b 100644
--- a/quic/core/quic_crypto_handshaker.cc
+++ b/quic/core/quic_crypto_handshaker.cc
@@ -20,13 +20,16 @@
QuicCryptoHandshaker::~QuicCryptoHandshaker() {}
void QuicCryptoHandshaker::SendHandshakeMessage(
- const CryptoHandshakeMessage& message) {
+ const CryptoHandshakeMessage& message,
+ EncryptionLevel level) {
QUIC_DVLOG(1) << ENDPOINT << "Sending " << message.DebugString();
session()->NeuterUnencryptedData();
session()->OnCryptoHandshakeMessageSent(message);
last_sent_handshake_message_tag_ = message.tag();
const QuicData& data = message.GetSerialized();
- stream_->WriteCryptoData(session_->connection()->encryption_level(),
+ stream_->WriteCryptoData(session_->use_write_or_buffer_data_at_level()
+ ? level
+ : session_->connection()->encryption_level(),
data.AsStringPiece());
}