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

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

Issue 2403193003: Landing Recent QUIC changes until 9:41 AM, Oct 10, 2016 UTC-7 (Closed)
Patch Set: git cl format Created 4 years, 2 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 | « net/quic/core/quic_connection.h ('k') | net/quic/core/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/core/quic_connection.h" 5 #include "net/quic/core/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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 /*delegate=*/nullptr)), 274 /*delegate=*/nullptr)),
275 version_negotiation_state_(START_NEGOTIATION), 275 version_negotiation_state_(START_NEGOTIATION),
276 perspective_(perspective), 276 perspective_(perspective),
277 connected_(true), 277 connected_(true),
278 can_truncate_connection_ids_(true), 278 can_truncate_connection_ids_(true),
279 mtu_discovery_target_(0), 279 mtu_discovery_target_(0),
280 mtu_probe_count_(0), 280 mtu_probe_count_(0),
281 packets_between_mtu_probes_(kPacketsBetweenMtuProbesBase), 281 packets_between_mtu_probes_(kPacketsBetweenMtuProbesBase),
282 next_mtu_probe_at_(kPacketsBetweenMtuProbesBase), 282 next_mtu_probe_at_(kPacketsBetweenMtuProbesBase),
283 largest_received_packet_size_(0), 283 largest_received_packet_size_(0),
284 largest_packet_size_supported_(std::numeric_limits<QuicByteCount>::max()),
285 goaway_sent_(false), 284 goaway_sent_(false),
286 goaway_received_(false), 285 goaway_received_(false),
287 multipath_enabled_(false), 286 multipath_enabled_(false),
288 write_error_occured_(false) { 287 write_error_occured_(false) {
289 DVLOG(1) << ENDPOINT 288 DVLOG(1) << ENDPOINT
290 << "Created connection with connection_id: " << connection_id; 289 << "Created connection with connection_id: " << connection_id;
291 framer_.set_visitor(this); 290 framer_.set_visitor(this);
292 framer_.set_received_entropy_calculator(&received_packet_manager_); 291 framer_.set_received_entropy_calculator(&received_packet_manager_);
293 if (!FLAGS_quic_receive_packet_once_decrypted) { 292 if (!FLAGS_quic_receive_packet_once_decrypted) {
294 last_stop_waiting_frame_.least_unacked = 0; 293 last_stop_waiting_frame_.least_unacked = 0;
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 } 1410 }
1412 1411
1413 void QuicConnection::WriteAndBundleAcksIfNotBlocked() { 1412 void QuicConnection::WriteAndBundleAcksIfNotBlocked() {
1414 if (!writer_->IsWriteBlocked()) { 1413 if (!writer_->IsWriteBlocked()) {
1415 ScopedPacketBundler bundler(this, SEND_ACK_IF_QUEUED); 1414 ScopedPacketBundler bundler(this, SEND_ACK_IF_QUEUED);
1416 OnCanWrite(); 1415 OnCanWrite();
1417 } 1416 }
1418 } 1417 }
1419 1418
1420 bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) { 1419 bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) {
1421 if (header.fec_flag) {
1422 // Drop any FEC packet.
1423 return false;
1424 }
1425
1426 if (perspective_ == Perspective::IS_SERVER && 1420 if (perspective_ == Perspective::IS_SERVER &&
1427 IsInitializedIPEndPoint(self_address_) && 1421 IsInitializedIPEndPoint(self_address_) &&
1428 IsInitializedIPEndPoint(last_packet_destination_address_) && 1422 IsInitializedIPEndPoint(last_packet_destination_address_) &&
1429 (!(self_address_ == last_packet_destination_address_))) { 1423 (!(self_address_ == last_packet_destination_address_))) {
1430 if (!FLAGS_quic_allow_server_address_change_for_mapped_ipv4) { 1424 if (!FLAGS_quic_allow_server_address_change_for_mapped_ipv4) {
1431 CloseConnection(QUIC_ERROR_MIGRATING_ADDRESS, 1425 CloseConnection(QUIC_ERROR_MIGRATING_ADDRESS,
1432 "Self address migration is not supported at the server.", 1426 "Self address migration is not supported at the server.",
1433 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 1427 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
1434 return false; 1428 return false;
1435 } 1429 }
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 2441
2448 QuicByteCount QuicConnection::GetLimitedMaxPacketSize( 2442 QuicByteCount QuicConnection::GetLimitedMaxPacketSize(
2449 QuicByteCount suggested_max_packet_size) { 2443 QuicByteCount suggested_max_packet_size) {
2450 if (peer_address_.address().empty()) { 2444 if (peer_address_.address().empty()) {
2451 QUIC_BUG << "Attempted to use a connection without a valid peer address"; 2445 QUIC_BUG << "Attempted to use a connection without a valid peer address";
2452 return suggested_max_packet_size; 2446 return suggested_max_packet_size;
2453 } 2447 }
2454 2448
2455 const QuicByteCount writer_limit = writer_->GetMaxPacketSize(peer_address()); 2449 const QuicByteCount writer_limit = writer_->GetMaxPacketSize(peer_address());
2456 2450
2457 return std::min({suggested_max_packet_size, writer_limit, kMaxPacketSize, 2451 QuicByteCount max_packet_size = suggested_max_packet_size;
2458 largest_packet_size_supported_}); 2452 if (max_packet_size > writer_limit) {
2453 max_packet_size = writer_limit;
2454 }
2455 if (max_packet_size > kMaxPacketSize) {
2456 max_packet_size = kMaxPacketSize;
2457 }
2458 return max_packet_size;
2459 } 2459 }
2460 2460
2461 void QuicConnection::SendMtuDiscoveryPacket(QuicByteCount target_mtu) { 2461 void QuicConnection::SendMtuDiscoveryPacket(QuicByteCount target_mtu) {
2462 // Currently, this limit is ensured by the caller. 2462 // Currently, this limit is ensured by the caller.
2463 DCHECK_EQ(target_mtu, GetLimitedMaxPacketSize(target_mtu)); 2463 DCHECK_EQ(target_mtu, GetLimitedMaxPacketSize(target_mtu));
2464 2464
2465 // Send the probe. 2465 // Send the probe.
2466 packet_generator_.GenerateMtuDiscoveryPacket(target_mtu, nullptr); 2466 packet_generator_.GenerateMtuDiscoveryPacket(target_mtu, nullptr);
2467 } 2467 }
2468 2468
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 2590
2591 void QuicConnection::CheckIfApplicationLimited() { 2591 void QuicConnection::CheckIfApplicationLimited() {
2592 if (queued_packets_.empty() && 2592 if (queued_packets_.empty() &&
2593 !sent_packet_manager_->HasPendingRetransmissions() && 2593 !sent_packet_manager_->HasPendingRetransmissions() &&
2594 !visitor_->WillingAndAbleToWrite()) { 2594 !visitor_->WillingAndAbleToWrite()) {
2595 sent_packet_manager_->OnApplicationLimited(); 2595 sent_packet_manager_->OnApplicationLimited();
2596 } 2596 }
2597 } 2597 }
2598 2598
2599 } // namespace net 2599 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection.h ('k') | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698