Deprecate gfe2_reloadable_flag_quic_use_encryption_level_context.
PiperOrigin-RevId: 387113513
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 7bcf5a4..634af51 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -364,17 +364,11 @@
clock_->ApproximateNow(),
&arena_,
alarm_factory_),
- use_encryption_level_context_(
- GetQuicReloadableFlag(quic_use_encryption_level_context)),
path_validator_(alarm_factory_, &arena_, this, random_generator_),
most_recent_frame_type_(NUM_FRAME_TYPES) {
QUICHE_DCHECK(perspective_ == Perspective::IS_CLIENT ||
default_path_.self_address.IsInitialized());
- if (use_encryption_level_context_) {
- QUIC_RELOADABLE_FLAG_COUNT(quic_use_encryption_level_context);
- }
-
if (add_missing_update_ack_timeout_) {
QUIC_RELOADABLE_FLAG_COUNT(quic_add_missing_update_ack_timeout);
}
@@ -4195,9 +4189,7 @@
!visitor_->ShouldKeepConnectionAlive()) {
return;
}
- SendPingAtLevel(use_encryption_level_context_
- ? framer().GetEncryptionLevelToSendApplicationData()
- : encryption_level_);
+ SendPingAtLevel(framer().GetEncryptionLevelToSendApplicationData());
}
void QuicConnection::SendAck() {
@@ -4654,12 +4646,8 @@
default_path_.server_connection_id, connection_migration_use_new_cid_);
if (!SupportsMultiplePacketNumberSpaces()) {
QUIC_DLOG(INFO) << ENDPOINT << "Sending connection close packet.";
- if (!use_encryption_level_context_) {
- SetDefaultEncryptionLevel(GetConnectionCloseEncryptionLevel());
- }
- ScopedEncryptionLevelContext context(
- use_encryption_level_context_ ? this : nullptr,
- GetConnectionCloseEncryptionLevel());
+ ScopedEncryptionLevelContext context(this,
+ GetConnectionCloseEncryptionLevel());
if (version().CanSendCoalescedPackets()) {
coalesced_packet_.Clear();
}
@@ -4690,7 +4678,6 @@
ClearQueuedPackets();
return;
}
- const EncryptionLevel current_encryption_level = encryption_level_;
ScopedPacketFlusher flusher(this);
// Now that the connection is being closed, discard any unsent packets
@@ -4708,11 +4695,7 @@
}
QUIC_DLOG(INFO) << ENDPOINT
<< "Sending connection close packet at level: " << level;
- if (!use_encryption_level_context_) {
- SetDefaultEncryptionLevel(level);
- }
- ScopedEncryptionLevelContext context(
- use_encryption_level_context_ ? this : nullptr, level);
+ ScopedEncryptionLevelContext context(this, level);
// Bundle an ACK of the corresponding packet number space for debugging
// purpose.
bool send_ack = error != QUIC_PACKET_WRITE_ERROR &&
@@ -4745,9 +4728,6 @@
// Since the connection is closing, if the connection close packets were not
// sent, then they should be discarded.
ClearQueuedPackets();
- if (!use_encryption_level_context_) {
- SetDefaultEncryptionLevel(current_encryption_level);
- }
}
void QuicConnection::TearDownLocalConnectionState(
@@ -5988,8 +5968,6 @@
if (!earliest_ack_timeout.IsInitialized()) {
return;
}
- // Latches current encryption level.
- const EncryptionLevel current_encryption_level = encryption_level_;
for (int8_t i = INITIAL_DATA; i <= APPLICATION_DATA; ++i) {
const QuicTime ack_timeout = uber_received_packet_manager_.GetAckTimeout(
static_cast<PacketNumberSpace>(i));
@@ -6009,14 +5987,8 @@
QUIC_DVLOG(1) << ENDPOINT << "Sending ACK of packet number space "
<< PacketNumberSpaceToString(
static_cast<PacketNumberSpace>(i));
- // Switch to the appropriate encryption level.
- if (!use_encryption_level_context_) {
- SetDefaultEncryptionLevel(
- QuicUtils::GetEncryptionLevel(static_cast<PacketNumberSpace>(i)));
- }
ScopedEncryptionLevelContext context(
- use_encryption_level_context_ ? this : nullptr,
- QuicUtils::GetEncryptionLevel(static_cast<PacketNumberSpace>(i)));
+ this, QuicUtils::GetEncryptionLevel(static_cast<PacketNumberSpace>(i)));
QuicFrames frames;
frames.push_back(uber_received_packet_manager_.GetUpdatedAckFrame(
static_cast<PacketNumberSpace>(i), clock_->ApproximateNow()));
@@ -6032,10 +6004,6 @@
}
ResetAckStates();
}
- if (!use_encryption_level_context_) {
- // Restores encryption level.
- SetDefaultEncryptionLevel(current_encryption_level);
- }
const QuicTime timeout =
uber_received_packet_manager_.GetEarliestAckTimeout();
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 09f387e..2409c76 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -1202,10 +1202,6 @@
bool is_processing_packet() const { return framer_.is_processing_packet(); }
- bool use_encryption_level_context() const {
- return use_encryption_level_context_;
- }
-
bool HasPendingPathValidation() const;
QuicPathValidationContext* GetPathValidationContext() const;
@@ -1226,9 +1222,7 @@
void SetSourceAddressTokenToSend(absl::string_view token);
void SendPing() {
- SendPingAtLevel(use_encryption_level_context_
- ? framer().GetEncryptionLevelToSendApplicationData()
- : encryption_level_);
+ SendPingAtLevel(framer().GetEncryptionLevelToSendApplicationData());
}
virtual std::vector<QuicConnectionId> GetActiveServerConnectionIds() const;
@@ -2245,8 +2239,6 @@
// True if we are currently processing OnRetransmissionTimeout.
bool in_on_retransmission_time_out_ = false;
- const bool use_encryption_level_context_;
-
QuicPathValidator path_validator_;
// Stores information of a path which maybe used as default path in the
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h
index 1716f2c..dbbffb0 100644
--- a/quic/core/quic_flags_list.h
+++ b/quic/core/quic_flags_list.h
@@ -109,8 +109,6 @@
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_group_path_response_and_challenge_sending_closer, true)
// If true, use BBRv2 as the default congestion controller. Takes precedence over --quic_default_to_bbr.
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_default_to_bbr_v2, false)
-// If true, use ScopedEncryptionLevelContext when sending data.
-QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_use_encryption_level_context, true)
// If true, use new connection ID in connection migration.
QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_connection_migration_use_new_cid_v2, true)
// If true, uses conservative cwnd gain and pacing gain when cwnd gets bootstrapped.
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index ea6da6c..2cd3525 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -794,13 +794,7 @@
}
SetTransmissionType(type);
- const auto current_level = connection()->encryption_level();
- if (!use_encryption_level_context()) {
- connection()->SetDefaultEncryptionLevel(level);
- }
- QuicConnection::ScopedEncryptionLevelContext context(
- use_encryption_level_context() ? connection() : nullptr,
- use_encryption_level_context() ? level : NUM_ENCRYPTION_LEVELS);
+ QuicConnection::ScopedEncryptionLevelContext context(connection(), level);
QuicConsumedData data =
connection_->SendStreamData(id, write_length, offset, state);
@@ -809,12 +803,6 @@
write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed);
}
- // Restore the encryption level.
- if (!use_encryption_level_context()) {
- // Restore the encryption level.
- connection()->SetDefaultEncryptionLevel(current_level);
- }
-
return data;
}
@@ -834,18 +822,9 @@
return 0;
}
SetTransmissionType(type);
- const auto current_level = connection()->encryption_level();
- if (!use_encryption_level_context()) {
- connection_->SetDefaultEncryptionLevel(level);
- }
- QuicConnection::ScopedEncryptionLevelContext context(
- use_encryption_level_context() ? connection() : nullptr, level);
+ QuicConnection::ScopedEncryptionLevelContext context(connection(), level);
const auto bytes_consumed =
connection_->SendCryptoData(level, write_length, offset);
- if (!use_encryption_level_context()) {
- // Restores encryption level.
- connection_->SetDefaultEncryptionLevel(current_level);
- }
return bytes_consumed;
}
@@ -866,9 +845,7 @@
}
SetTransmissionType(type);
QuicConnection::ScopedEncryptionLevelContext context(
- use_encryption_level_context() ? connection() : nullptr,
- use_encryption_level_context() ? GetEncryptionLevelToSendApplicationData()
- : NUM_ENCRYPTION_LEVELS);
+ connection(), GetEncryptionLevelToSendApplicationData());
return connection_->SendControlFrame(frame);
}
@@ -2472,9 +2449,7 @@
return {MESSAGE_STATUS_ENCRYPTION_NOT_ESTABLISHED, 0};
}
QuicConnection::ScopedEncryptionLevelContext context(
- use_encryption_level_context() ? connection() : nullptr,
- use_encryption_level_context() ? GetEncryptionLevelToSendApplicationData()
- : NUM_ENCRYPTION_LEVELS);
+ connection(), GetEncryptionLevelToSendApplicationData());
MessageStatus result =
connection_->SendMessage(last_message_id_ + 1, message, flush);
if (result == MESSAGE_STATUS_SUCCESS) {
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index c7d96e9..9eb7bd1 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -619,10 +619,6 @@
return liveness_testing_in_progress_;
}
- bool use_encryption_level_context() const {
- return connection_->use_encryption_level_context();
- }
-
bool permutes_tls_extensions() const { return permutes_tls_extensions_; }
virtual QuicSSLConfig GetSSLConfig() const { return QuicSSLConfig(); }