gfe-relnote: Reset consecutive_pto_count and loss detection when discarding keys. Protected by existing quic_enable_version_draft_25_v3 and quic_enable_version_draft_27.
PiperOrigin-RevId: 303776374
Change-Id: I01d59ef42e988c3b2a0738c1735bebfa4a61f123
diff --git a/quic/core/congestion_control/general_loss_algorithm.cc b/quic/core/congestion_control/general_loss_algorithm.cc
index 5136648..6c09013 100644
--- a/quic/core/congestion_control/general_loss_algorithm.cc
+++ b/quic/core/congestion_control/general_loss_algorithm.cc
@@ -157,4 +157,9 @@
packet_number_space_ = packet_number_space;
}
+void GeneralLossAlgorithm::Reset() {
+ loss_detection_timeout_ = QuicTime::Zero();
+ least_in_flight_.Clear();
+}
+
} // namespace quic
diff --git a/quic/core/congestion_control/general_loss_algorithm.h b/quic/core/congestion_control/general_loss_algorithm.h
index 57c483e..7ab0d53 100644
--- a/quic/core/congestion_control/general_loss_algorithm.h
+++ b/quic/core/congestion_control/general_loss_algorithm.h
@@ -64,6 +64,8 @@
void SetPacketNumberSpace(PacketNumberSpace packet_number_space);
+ void Reset();
+
int reordering_shift() const { return reordering_shift_; }
void set_reordering_shift(int reordering_shift) {
diff --git a/quic/core/congestion_control/uber_loss_algorithm.cc b/quic/core/congestion_control/uber_loss_algorithm.cc
index 08f0b6b..73b26f5 100644
--- a/quic/core/congestion_control/uber_loss_algorithm.cc
+++ b/quic/core/congestion_control/uber_loss_algorithm.cc
@@ -134,4 +134,12 @@
}
}
+void UberLossAlgorithm::ResetLossDetection(PacketNumberSpace space) {
+ if (space >= NUM_PACKET_NUMBER_SPACES) {
+ QUIC_BUG << "Invalid packet number space: " << space;
+ return;
+ }
+ general_loss_algorithms_[space].Reset();
+}
+
} // namespace quic
diff --git a/quic/core/congestion_control/uber_loss_algorithm.h b/quic/core/congestion_control/uber_loss_algorithm.h
index 37b83c6..ff1ac81 100644
--- a/quic/core/congestion_control/uber_loss_algorithm.h
+++ b/quic/core/congestion_control/uber_loss_algorithm.h
@@ -88,6 +88,9 @@
// Disable packet threshold loss detection for *runt* packets.
void DisablePacketThresholdForRuntPackets();
+ // Called to reset loss detection of |space|.
+ void ResetLossDetection(PacketNumberSpace space);
+
private:
friend class test::QuicSentPacketManagerPeer;
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index d87d6c7..aeec09c 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -483,6 +483,10 @@
send_algorithm_->OnPacketNeutered(packet_number);
}
}
+ if (handshake_mode_disabled_) {
+ consecutive_pto_count_ = 0;
+ uber_loss_algorithm_.ResetLossDetection(INITIAL_DATA);
+ }
}
void QuicSentPacketManager::NeuterHandshakePackets() {
@@ -494,6 +498,10 @@
send_algorithm_->OnPacketNeutered(packet_number);
}
}
+ if (handshake_mode_disabled_) {
+ consecutive_pto_count_ = 0;
+ uber_loss_algorithm_.ResetLossDetection(HANDSHAKE_DATA);
+ }
}
bool QuicSentPacketManager::ShouldAddMaxAckDelay() const {
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index 573a857..98e6af0 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -3231,6 +3231,7 @@
// Send packet 4 in application data with 0-RTT.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(10));
SendDataPacket(4, ENCRYPTION_ZERO_RTT);
+ const QuicTime packet4_sent_time = clock_.Now();
// Verify PTO timeout is still based on packet 3.
EXPECT_EQ(packet3_sent_time + expected_pto_delay * 2,
manager_.GetRetransmissionTime());
@@ -3261,8 +3262,9 @@
// Neuter handshake key.
manager_.SetHandshakeConfirmed();
- // Verify PTO timeout remains unchanged.
- EXPECT_EQ(packet6_sent_time + expected_pto_delay * 2,
+ // Forward progress has been made, verify PTO counter gets reset. PTO timeout
+ // is armed by left edge.
+ EXPECT_EQ(packet4_sent_time + expected_pto_delay,
manager_.GetRetransmissionTime());
}