Internal QUICHE change PiperOrigin-RevId: 332070542 Change-Id: Ifc8b12a9f7f04611d2b9ff25b48e46848827aef3
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index a36017c..d5bfc79 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -201,6 +201,7 @@ // Enable fixes for bugs found in tests and prod. SetQuicRestartFlag(quic_enable_tls_resumption_v4, true); SetQuicRestartFlag(quic_enable_zero_rtt_for_tls_v2, true); + SetQuicReloadableFlag(quic_fix_out_of_order_sending, true); } ~EndToEndTest() override { QuicRecyclePort(server_address_.port()); } @@ -530,8 +531,7 @@ if (server_connection != nullptr) { QuicConnectionStats server_stats = server_connection->GetStats(); if (!had_packet_loss) { - EXPECT_EQ(0u, server_stats.packets_lost - - server_stats.packet_spuriously_detected_lost); + EXPECT_EQ(0u, server_stats.packets_lost); } EXPECT_EQ(0u, server_stats.packets_discarded); EXPECT_EQ(server_session->user_agent_id().value_or("MissingUserAgent"), @@ -1496,11 +1496,6 @@ EXPECT_FALSE(client_session->ReceivedInchoateReject()); EXPECT_FALSE(client_->client()->EarlyDataAccepted()); EXPECT_FALSE(client_->client()->ReceivedInchoateReject()); - while (client_->client()->connected() && - client_session->connection()->HasPendingAcks()) { - // Flush all pending acks. - client_->client()->WaitForEvents(); - } VerifyCleanConnection(false); }
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index bae994f..83f7fd7 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -4781,11 +4781,20 @@ DCHECK(!is_mtu_discovery); return LEGACY_VERSION_ENCAPSULATE; } - if (version().CanSendCoalescedPackets() && !IsHandshakeConfirmed() && - !is_mtu_discovery) { - // Before receiving ACK for any 1-RTT packets, always try to coalesce - // packet (except MTU discovery packet). - return COALESCE; + if (version().CanSendCoalescedPackets() && !is_mtu_discovery) { + if (!IsHandshakeConfirmed()) { + // Before receiving ACK for any 1-RTT packets, always try to coalesce + // packet (except MTU discovery packet). + return COALESCE; + } + if (GetQuicReloadableFlag(quic_fix_out_of_order_sending)) { + QUIC_RELOADABLE_FLAG_COUNT(quic_fix_out_of_order_sending); + if (coalesced_packet_.length() > 0) { + // If the coalescer is not empty, let this packet go through coalescer + // to avoid potential out of order sending. + return COALESCE; + } + } } if (!buffered_packets_.empty() || HandleWriteBlocked()) { return BUFFER;