gfe-relnote: Deprecate gfe2_restart_flag_quic_send_settings_on_write_key_available. PiperOrigin-RevId: 309055939 Change-Id: Ia10a0edff3b5bfe6e0a42145e94fe6be130ee6d3
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc index 2ab8637..c5ed028 100644 --- a/quic/core/http/quic_spdy_session.cc +++ b/quic/core/http/quic_spdy_session.cc
@@ -784,24 +784,8 @@ EncryptionLevel level, std::unique_ptr<QuicEncrypter> encrypter) { QuicSession::OnNewEncryptionKeyAvailable(level, std::move(encrypter)); - if (GetQuicRestartFlag(quic_send_settings_on_write_key_available) && - IsEncryptionEstablished()) { + if (IsEncryptionEstablished()) { // Send H3 SETTINGs once encryption is established. - QUIC_RESTART_FLAG_COUNT_N(quic_send_settings_on_write_key_available, 2, 2); - SendInitialData(); - } -} - -void QuicSpdySession::SetDefaultEncryptionLevel(quic::EncryptionLevel level) { - QuicSession::SetDefaultEncryptionLevel(level); - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - SendInitialData(); - } -} - -void QuicSpdySession::OnOneRttKeysAvailable() { - QuicSession::OnOneRttKeysAvailable(); - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { SendInitialData(); } }
diff --git a/quic/core/http/quic_spdy_session.h b/quic/core/http/quic_spdy_session.h index 2d84bf7..27d1d8f 100644 --- a/quic/core/http/quic_spdy_session.h +++ b/quic/core/http/quic_spdy_session.h
@@ -420,9 +420,6 @@ EncryptionLevel level, std::unique_ptr<QuicEncrypter> encrypter) override; - void SetDefaultEncryptionLevel(quic::EncryptionLevel level) override; - void OnOneRttKeysAvailable() override; - // Optional, enables instrumentation related to go/quic-hpack. void SetHpackEncoderDebugVisitor( std::unique_ptr<QuicHpackDebugVisitor> visitor);
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index 930fc2f..43932bf 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -1503,12 +1503,10 @@ std::unique_ptr<QuicEncrypter> encrypter) { connection()->SetEncrypter(level, std::move(encrypter)); - if (GetQuicRestartFlag(quic_send_settings_on_write_key_available) && - connection_->version().handshake_protocol == PROTOCOL_TLS1_3 && + if (connection_->version().handshake_protocol == PROTOCOL_TLS1_3 && level == ENCRYPTION_FORWARD_SECURE) { // Set connection's default encryption level once 1-RTT write key is // available. - QUIC_RESTART_FLAG_COUNT_N(quic_send_settings_on_write_key_available, 1, 2); QUIC_DVLOG(1) << ENDPOINT << "Set default encryption level to " << EncryptionLevelToString(level); connection()->SetDefaultEncryptionLevel(level); @@ -1550,12 +1548,6 @@ void QuicSession::OnOneRttKeysAvailable() { DCHECK_EQ(PROTOCOL_TLS1_3, connection_->version().handshake_protocol); - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - QUIC_DVLOG(1) << ENDPOINT << "Set default encryption level to " - << EncryptionLevelToString(ENCRYPTION_FORWARD_SECURE); - connection()->SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE); - } - QUIC_BUG_IF(!GetCryptoStream()->crypto_negotiated_params().cipher_suite) << ENDPOINT << "Handshake completes without cipher suite negotiation."; QUIC_BUG_IF(!config_.negotiated())
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc index 9379087..d6435ff 100644 --- a/quic/core/tls_client_handshaker.cc +++ b/quic/core/tls_client_handshaker.cc
@@ -318,8 +318,7 @@ EncryptionLevel level, const SSL_CIPHER* cipher, const std::vector<uint8_t>& write_secret) { - if (GetQuicRestartFlag(quic_send_settings_on_write_key_available) && - level == ENCRYPTION_FORWARD_SECURE) { + if (level == ENCRYPTION_FORWARD_SECURE) { encryption_established_ = true; } TlsHandshaker::SetWriteSecret(level, cipher, write_secret); @@ -391,16 +390,14 @@ void TlsClientHandshaker::FinishHandshake() { QUIC_LOG(INFO) << "Client: handshake finished"; state_ = STATE_HANDSHAKE_COMPLETE; - if (GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - // Fill crypto_negotiated_params_: - const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl()); - if (cipher) { - crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher); - } - crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl()); - crypto_negotiated_params_->peer_signature_algorithm = - SSL_get_peer_signature_algorithm(ssl()); + // Fill crypto_negotiated_params_: + const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl()); + if (cipher) { + crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher); } + crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl()); + crypto_negotiated_params_->peer_signature_algorithm = + SSL_get_peer_signature_algorithm(ssl()); std::string error_details; if (!ProcessTransportParameters(&error_details)) { @@ -436,23 +433,7 @@ session()->OnAlpnSelected(received_alpn_string); QUIC_DLOG(INFO) << "Client: server selected ALPN: '" << received_alpn_string << "'"; - - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - encryption_established_ = true; - } one_rtt_keys_available_ = true; - - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - // Fill crypto_negotiated_params_: - const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl()); - if (cipher) { - crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher); - } - crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl()); - crypto_negotiated_params_->peer_signature_algorithm = - SSL_get_peer_signature_algorithm(ssl()); - } - handshaker_delegate()->OnOneRttKeysAvailable(); }
diff --git a/quic/core/tls_client_handshaker_test.cc b/quic/core/tls_client_handshaker_test.cc index 0ba517f..fe757b4 100644 --- a/quic/core/tls_client_handshaker_test.cc +++ b/quic/core/tls_client_handshaker_test.cc
@@ -387,11 +387,9 @@ server_connection_, server_stream(), 0); EXPECT_FALSE(stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - stream()->encryption_established()); + EXPECT_TRUE(stream()->encryption_established()); EXPECT_FALSE(server_stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - server_stream()->encryption_established()); + EXPECT_TRUE(server_stream()->encryption_established()); } } // namespace
diff --git a/quic/core/tls_server_handshaker.cc b/quic/core/tls_server_handshaker.cc index cef5efe..249973c 100644 --- a/quic/core/tls_server_handshaker.cc +++ b/quic/core/tls_server_handshaker.cc
@@ -326,8 +326,7 @@ EncryptionLevel level, const SSL_CIPHER* cipher, const std::vector<uint8_t>& write_secret) { - if (GetQuicRestartFlag(quic_send_settings_on_write_key_available) && - level == ENCRYPTION_FORWARD_SECURE) { + if (level == ENCRYPTION_FORWARD_SECURE) { encryption_established_ = true; // Fill crypto_negotiated_params_: const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl()); @@ -352,20 +351,9 @@ QUIC_LOG(INFO) << "Server: handshake finished"; state_ = STATE_HANDSHAKE_COMPLETE; - - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - encryption_established_ = true; - } one_rtt_keys_available_ = true; const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl()); - if (!GetQuicRestartFlag(quic_send_settings_on_write_key_available)) { - // Fill crypto_negotiated_params_: - if (cipher) { - crypto_negotiated_params_->cipher_suite = SSL_CIPHER_get_value(cipher); - } - crypto_negotiated_params_->key_exchange_group = SSL_get_curve_id(ssl()); - } if (!app_data_read_secret_.empty()) { if (!SetReadSecret(ENCRYPTION_FORWARD_SECURE, cipher,
diff --git a/quic/core/tls_server_handshaker_test.cc b/quic/core/tls_server_handshaker_test.cc index 52d5627..28f13c6 100644 --- a/quic/core/tls_server_handshaker_test.cc +++ b/quic/core/tls_server_handshaker_test.cc
@@ -306,11 +306,9 @@ AdvanceHandshakeWithFakeClient(); EXPECT_FALSE(client_stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - client_stream()->encryption_established()); + EXPECT_TRUE(client_stream()->encryption_established()); EXPECT_FALSE(server_stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - server_stream()->encryption_established()); + EXPECT_TRUE(server_stream()->encryption_established()); } TEST_F(TlsServerHandshakerTest, ClientSendingBadALPN) { @@ -329,11 +327,9 @@ AdvanceHandshakeWithFakeClient(); EXPECT_FALSE(client_stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - client_stream()->encryption_established()); + EXPECT_TRUE(client_stream()->encryption_established()); EXPECT_FALSE(server_stream()->one_rtt_keys_available()); - EXPECT_EQ(GetQuicRestartFlag(quic_send_settings_on_write_key_available), - server_stream()->encryption_established()); + EXPECT_TRUE(server_stream()->encryption_established()); } TEST_F(TlsServerHandshakerTest, CustomALPNNegotiation) {