Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index e070ef63fa2b54b9664c1a33a24372efd38172b4..c9707516f32cb8400aac4bbd26e223a02b799aeb 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -623,7 +623,8 @@ bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) { |
// If this packet has already been seen, or the sender has told us that it |
// will not be retransmitted, then stop processing the packet. |
- if (!received_packet_manager_.IsAwaitingPacket(header.packet_number)) { |
+ if (FLAGS_quic_drop_non_awaited_packets && |
+ !received_packet_manager_.IsAwaitingPacket(header.packet_number)) { |
DVLOG(1) << ENDPOINT << "Packet " << header.packet_number |
<< " no longer being waited for. Discarding."; |
if (debug_visitor_ != nullptr) { |
@@ -1983,7 +1984,15 @@ void QuicConnection::MaybeProcessRevivedPacket() { |
QuicFecGroup* QuicConnection::GetFecGroup() { |
QuicFecGroupNumber fec_group_num = last_header_.fec_group; |
- if (fec_group_num == 0) { |
+ if (fec_group_num == 0 || |
+ (FLAGS_quic_drop_non_awaited_packets && |
+ fec_group_num < |
+ received_packet_manager_.peer_least_packet_awaiting_ack() && |
+ !ContainsKey(group_map_, fec_group_num))) { |
+ // If the group number is below peer_least_packet_awaiting_ack and this |
+ // group does not exist, which means this group has missing packets below |
+ // |peer_least_packet_awaiting_ack| which we would never receive, so return |
+ // nullptr. |
return nullptr; |
} |
if (!ContainsKey(group_map_, fec_group_num)) { |
@@ -2078,9 +2087,9 @@ void QuicConnection::SendGoAway(QuicErrorCode error, |
void QuicConnection::CloseFecGroupsBefore(QuicPacketNumber packet_number) { |
FecGroupMap::iterator it = group_map_.begin(); |
while (it != group_map_.end()) { |
- // If this is the current group or the group doesn't protect this packet |
- // we can ignore it. |
- if (last_header_.fec_group == it->first || |
+ // If the group doesn't protect this packet we can ignore it. |
+ if ((!FLAGS_quic_drop_non_awaited_packets && |
+ last_header_.fec_group == it->first) || |
!it->second->IsWaitingForPacketBefore(packet_number)) { |
++it; |
continue; |