Add QUIC_BUG_IF on empty opportunistic ACKs
Based on the discussion in cl/249218514, we'd rather not hide a potential bug in the codebase. So this CL adds a QUIC_BUG_IF with detailed information in case this happens again down the road.
gfe-relnote: no behavior change, only add QUIC_BUG_IF, not flag protected
PiperOrigin-RevId: 249624687
Change-Id: Ie3c09687aa7e824f5bf82fbe73c3e974291051a0
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 2260766..4e93fdf 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -2413,7 +2413,14 @@
ResetAckStates();
QUIC_DVLOG(1) << ENDPOINT << "Bundle an ACK opportunistically";
- frames.push_back(GetUpdatedAckFrame());
+ QuicFrame updated_ack_frame = GetUpdatedAckFrame();
+ QUIC_BUG_IF(updated_ack_frame.ack_frame->packets.Empty())
+ << ENDPOINT << "Attempted to opportunistically bundle an empty "
+ << QuicUtils::EncryptionLevelToString(encryption_level_) << " ACK, "
+ << (has_pending_ack ? "" : "!") << "has_pending_ack, stop_waiting_count_ "
+ << stop_waiting_count_;
+ frames.push_back(updated_ack_frame);
+
if (!no_stop_waiting_frames_) {
QuicStopWaitingFrame stop_waiting;
PopulateStopWaitingFrame(&stop_waiting);