Internal change

PiperOrigin-RevId: 374734368
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index f64d3ee..09806f5 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -448,6 +448,7 @@
 }
 
 QuicConnection::~QuicConnection() {
+  QUICHE_DCHECK_GE(stats_.max_egress_mtu, long_term_mtu_);
   if (owns_writer_) {
     delete writer_;
   }
@@ -4729,6 +4730,7 @@
 
 void QuicConnection::SetMaxPacketLength(QuicByteCount length) {
   long_term_mtu_ = length;
+  stats_.max_egress_mtu = std::max(stats_.max_egress_mtu, long_term_mtu_);
   MaybeUpdatePacketCreatorMaxPacketLengthAndPadding();
 }
 
diff --git a/quic/core/quic_connection_stats.cc b/quic/core/quic_connection_stats.cc
index da15785..fbaa20a 100644
--- a/quic/core/quic_connection_stats.cc
+++ b/quic/core/quic_connection_stats.cc
@@ -35,6 +35,7 @@
   os << " min_rtt_us: " << s.min_rtt_us;
   os << " srtt_us: " << s.srtt_us;
   os << " egress_mtu: " << s.egress_mtu;
+  os << " max_egress_mtu: " << s.max_egress_mtu;
   os << " ingress_mtu: " << s.ingress_mtu;
   os << " estimated_bandwidth: " << s.estimated_bandwidth;
   os << " packets_reordered: " << s.packets_reordered;
diff --git a/quic/core/quic_connection_stats.h b/quic/core/quic_connection_stats.h
index 570b44e..39fd5b0 100644
--- a/quic/core/quic_connection_stats.h
+++ b/quic/core/quic_connection_stats.h
@@ -103,9 +103,13 @@
   int64_t min_rtt_us = 0;  // Minimum RTT in microseconds.
   int64_t srtt_us = 0;     // Smoothed RTT in microseconds.
   int64_t cwnd_bootstrapping_rtt_us = 0;  // RTT used in cwnd_bootstrapping.
-  // The connection's |long_term_mtu_| used for sending packets.
+  // The connection's |long_term_mtu_| used for sending packets, populated by
+  // QuicConnection::GetStats().
   QuicByteCount egress_mtu = 0;
-  // Size of the largest packet received from the peer.
+  // The maximum |long_term_mtu_| the connection ever used.
+  QuicByteCount max_egress_mtu = 0;
+  // Size of the largest packet received from the peer, populated by
+  // QuicConnection::GetStats().
   QuicByteCount ingress_mtu = 0;
   QuicBandwidth estimated_bandwidth = QuicBandwidth::Zero();