Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: net/quic/quic_connection.cc

Issue 1729773002: Deprecate FLAGS_quic_drop_non_awaited_packets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@114852282
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 LOG(DFATAL) << "Received a packet with multipath flag on when multipath is " 637 LOG(DFATAL) << "Received a packet with multipath flag on when multipath is "
638 "not enabled."; 638 "not enabled.";
639 SendConnectionCloseWithDetails(QUIC_BAD_MULTIPATH_FLAG, 639 SendConnectionCloseWithDetails(QUIC_BAD_MULTIPATH_FLAG,
640 "receive a packet with multipath flag on " 640 "receive a packet with multipath flag on "
641 "when multipath is not enabled."); 641 "when multipath is not enabled.");
642 return false; 642 return false;
643 } 643 }
644 644
645 // If this packet has already been seen, or the sender has told us that it 645 // If this packet has already been seen, or the sender has told us that it
646 // will not be retransmitted, then stop processing the packet. 646 // will not be retransmitted, then stop processing the packet.
647 if (FLAGS_quic_drop_non_awaited_packets && 647 if (!received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
648 !received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
649 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number 648 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
650 << " no longer being waited for. Discarding."; 649 << " no longer being waited for. Discarding.";
651 if (debug_visitor_ != nullptr) { 650 if (debug_visitor_ != nullptr) {
652 debug_visitor_->OnDuplicatePacket(header.packet_number); 651 debug_visitor_->OnDuplicatePacket(header.packet_number);
653 } 652 }
654 ++stats_.packets_dropped; 653 ++stats_.packets_dropped;
655 return false; 654 return false;
656 } 655 }
657 656
658 return true; 657 return true;
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 } 1404 }
1406 1405
1407 if (!Near(header.packet_number, last_header_.packet_number)) { 1406 if (!Near(header.packet_number, last_header_.packet_number)) {
1408 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number 1407 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
1409 << " out of bounds. Discarding"; 1408 << " out of bounds. Discarding";
1410 SendConnectionCloseWithDetails(QUIC_INVALID_PACKET_HEADER, 1409 SendConnectionCloseWithDetails(QUIC_INVALID_PACKET_HEADER,
1411 "packet number out of bounds"); 1410 "packet number out of bounds");
1412 return false; 1411 return false;
1413 } 1412 }
1414 1413
1415 // If this packet has already been seen, or the sender has told us that it
1416 // will not be retransmitted, then stop processing the packet.
1417 if (!FLAGS_quic_drop_non_awaited_packets &&
1418 !received_packet_manager_.IsAwaitingPacket(header.packet_number)) {
1419 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
1420 << " no longer being waited for. Discarding.";
1421 if (debug_visitor_ != nullptr) {
1422 debug_visitor_->OnDuplicatePacket(header.packet_number);
1423 }
1424 return false;
1425 }
1426
1427 if (version_negotiation_state_ != NEGOTIATED_VERSION) { 1414 if (version_negotiation_state_ != NEGOTIATED_VERSION) {
1428 if (perspective_ == Perspective::IS_SERVER) { 1415 if (perspective_ == Perspective::IS_SERVER) {
1429 if (!header.public_header.version_flag) { 1416 if (!header.public_header.version_flag) {
1430 // Packets should have the version flag till version negotiation is 1417 // Packets should have the version flag till version negotiation is
1431 // done. 1418 // done.
1432 string error_details = 1419 string error_details =
1433 StringPrintf("%s Packet %" PRIu64 1420 StringPrintf("%s Packet %" PRIu64
1434 " without version flag before version negotiated.", 1421 " without version flag before version negotiated.",
1435 ENDPOINT, header.packet_number); 1422 ENDPOINT, header.packet_number);
1436 DLOG(WARNING) << error_details; 1423 DLOG(WARNING) << error_details;
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 } 2005 }
2019 2006
2020 ++stats_.packets_revived; 2007 ++stats_.packets_revived;
2021 framer_.ProcessRevivedPacket(&revived_header, 2008 framer_.ProcessRevivedPacket(&revived_header,
2022 StringPiece(revived_payload, len)); 2009 StringPiece(revived_payload, len));
2023 } 2010 }
2024 2011
2025 QuicFecGroup* QuicConnection::GetFecGroup() { 2012 QuicFecGroup* QuicConnection::GetFecGroup() {
2026 QuicFecGroupNumber fec_group_num = last_header_.fec_group; 2013 QuicFecGroupNumber fec_group_num = last_header_.fec_group;
2027 if (fec_group_num == 0 || 2014 if (fec_group_num == 0 ||
2028 (FLAGS_quic_drop_non_awaited_packets && 2015 (fec_group_num <
2029 fec_group_num <
2030 received_packet_manager_.peer_least_packet_awaiting_ack() && 2016 received_packet_manager_.peer_least_packet_awaiting_ack() &&
2031 !ContainsKey(group_map_, fec_group_num))) { 2017 !ContainsKey(group_map_, fec_group_num))) {
2032 // If the group number is below peer_least_packet_awaiting_ack and this 2018 // If the group number is below peer_least_packet_awaiting_ack and this
2033 // group does not exist, which means this group has missing packets below 2019 // group does not exist, which means this group has missing packets below
2034 // |peer_least_packet_awaiting_ack| which we would never receive, so return 2020 // |peer_least_packet_awaiting_ack| which we would never receive, so return
2035 // nullptr. 2021 // nullptr.
2036 return nullptr; 2022 return nullptr;
2037 } 2023 }
2038 if (!ContainsKey(group_map_, fec_group_num)) { 2024 if (!ContainsKey(group_map_, fec_group_num)) {
2039 if (group_map_.size() >= kMaxFecGroups) { // Too many groups 2025 if (group_map_.size() >= kMaxFecGroups) { // Too many groups
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 // Opportunistically bundle an ack with this outgoing packet. 2108 // Opportunistically bundle an ack with this outgoing packet.
2123 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK); 2109 ScopedPacketBundler ack_bundler(this, BUNDLE_PENDING_ACK);
2124 packet_generator_.AddControlFrame( 2110 packet_generator_.AddControlFrame(
2125 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason))); 2111 QuicFrame(new QuicGoAwayFrame(error, last_good_stream_id, reason)));
2126 } 2112 }
2127 2113
2128 void QuicConnection::CloseFecGroupsBefore(QuicPacketNumber packet_number) { 2114 void QuicConnection::CloseFecGroupsBefore(QuicPacketNumber packet_number) {
2129 FecGroupMap::iterator it = group_map_.begin(); 2115 FecGroupMap::iterator it = group_map_.begin();
2130 while (it != group_map_.end()) { 2116 while (it != group_map_.end()) {
2131 // If the group doesn't protect this packet we can ignore it. 2117 // If the group doesn't protect this packet we can ignore it.
2132 if ((!FLAGS_quic_drop_non_awaited_packets && 2118 if (!it->second->IsWaitingForPacketBefore(packet_number)) {
2133 last_header_.fec_group == it->first) ||
2134 !it->second->IsWaitingForPacketBefore(packet_number)) {
2135 ++it; 2119 ++it;
2136 continue; 2120 continue;
2137 } 2121 }
2138 QuicFecGroup* fec_group = it->second; 2122 QuicFecGroup* fec_group = it->second;
2139 DCHECK(!fec_group->CanRevive()); 2123 DCHECK(!fec_group->CanRevive());
2140 FecGroupMap::iterator next = it; 2124 FecGroupMap::iterator next = it;
2141 ++next; 2125 ++next;
2142 group_map_.erase(it); 2126 group_map_.erase(it);
2143 delete fec_group; 2127 delete fec_group;
2144 it = next; 2128 it = next;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 void QuicConnection::OnPathClosed(QuicPathId path_id) { 2495 void QuicConnection::OnPathClosed(QuicPathId path_id) {
2512 // Stop receiving packets on this path. 2496 // Stop receiving packets on this path.
2513 framer_.OnPathClosed(path_id); 2497 framer_.OnPathClosed(path_id);
2514 } 2498 }
2515 2499
2516 bool QuicConnection::ack_frame_updated() const { 2500 bool QuicConnection::ack_frame_updated() const {
2517 return received_packet_manager_.ack_frame_updated(); 2501 return received_packet_manager_.ack_frame_updated();
2518 } 2502 }
2519 2503
2520 } // namespace net 2504 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698