Internal QUICHE change

PiperOrigin-RevId: 312073007
Change-Id: I22241551490d37d8e2317cd91db5d054a58ff33f
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 5f20559..0747d4f 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -923,6 +923,9 @@
   --stats_.packets_dropped;
   QUIC_DVLOG(1) << ENDPOINT << "Received packet header: " << header;
   last_header_ = header;
+  if (!stats_.first_decrypted_packet.IsInitialized()) {
+    stats_.first_decrypted_packet = last_header_.packet_number;
+  }
 
   // Record packet receipt to populate ack info before processing stream
   // frames, since the processing may result in sending a bundled ack.
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h
index 3b0c85d..f4b747d 100644
--- a/quic/core/quic_connection_stats.h
+++ b/quic/core/quic_connection_stats.h
@@ -136,6 +136,9 @@
 
   // Whether there is any non app-limited bandwidth sample.
   bool has_non_app_limited_sample = false;
+
+  // Packet number of first decrypted packet.
+  QuicPacketNumber first_decrypted_packet;
 };
 
 }  // namespace quic
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 0b72013..7fb8453 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -3129,9 +3129,12 @@
   if (connection_.SupportsMultiplePacketNumberSpaces()) {
     return;
   }
+  const QuicConnectionStats& stats = connection_.GetStats();
+  EXPECT_FALSE(stats.first_decrypted_packet.IsInitialized());
   EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
   EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1);
   ProcessDataPacket(1);
+  EXPECT_EQ(QuicPacketNumber(1), stats.first_decrypted_packet);
   QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 2);
   QuicPacketNumber last_packet;
   SendStreamDataToPeer(1, "foo", 0, NO_FIN, &last_packet);  // Packet 1
@@ -3215,6 +3218,7 @@
   } else {
     EXPECT_EQ(QuicPacketNumber(7u), least_unacked());
   }
+  EXPECT_EQ(QuicPacketNumber(1), stats.first_decrypted_packet);
 }
 
 // QuicConnection should record the packet sent-time prior to sending the