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

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

Issue 2747443002: Landing recent QUIC changes until Sun Mar 5 09:18:09 2017 +0000 (Closed)
Patch Set: Created 3 years, 9 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
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 perspective_(perspective), 252 perspective_(perspective),
253 connected_(true), 253 connected_(true),
254 can_truncate_connection_ids_(true), 254 can_truncate_connection_ids_(true),
255 mtu_discovery_target_(0), 255 mtu_discovery_target_(0),
256 mtu_probe_count_(0), 256 mtu_probe_count_(0),
257 packets_between_mtu_probes_(kPacketsBetweenMtuProbesBase), 257 packets_between_mtu_probes_(kPacketsBetweenMtuProbesBase),
258 next_mtu_probe_at_(kPacketsBetweenMtuProbesBase), 258 next_mtu_probe_at_(kPacketsBetweenMtuProbesBase),
259 largest_received_packet_size_(0), 259 largest_received_packet_size_(0),
260 goaway_sent_(false), 260 goaway_sent_(false),
261 goaway_received_(false), 261 goaway_received_(false),
262 multipath_enabled_(false),
263 write_error_occured_(false), 262 write_error_occured_(false),
264 no_stop_waiting_frames_(false) { 263 no_stop_waiting_frames_(false) {
265 QUIC_DLOG(INFO) << ENDPOINT 264 QUIC_DLOG(INFO) << ENDPOINT
266 << "Created connection with connection_id: " << connection_id; 265 << "Created connection with connection_id: " << connection_id;
267 framer_.set_visitor(this); 266 framer_.set_visitor(this);
268 stats_.connection_creation_time = clock_->ApproximateNow(); 267 stats_.connection_creation_time = clock_->ApproximateNow();
269 // TODO(ianswett): Supply the NetworkChangeVisitor as a constructor argument 268 // TODO(ianswett): Supply the NetworkChangeVisitor as a constructor argument
270 // and make it required non-null, because it's always used. 269 // and make it required non-null, because it's always used.
271 sent_packet_manager_.SetNetworkChangeVisitor(this); 270 sent_packet_manager_.SetNetworkChangeVisitor(this);
272 // Allow the packet writer to potentially reduce the packet size to a value 271 // Allow the packet writer to potentially reduce the packet size to a value
(...skipping 27 matching lines...) Expand all
300 299
301 void QuicConnection::SetFromConfig(const QuicConfig& config) { 300 void QuicConnection::SetFromConfig(const QuicConfig& config) {
302 if (config.negotiated()) { 301 if (config.negotiated()) {
303 // Handshake complete, set handshake timeout to Infinite. 302 // Handshake complete, set handshake timeout to Infinite.
304 SetNetworkTimeouts(QuicTime::Delta::Infinite(), 303 SetNetworkTimeouts(QuicTime::Delta::Infinite(),
305 config.IdleNetworkTimeout()); 304 config.IdleNetworkTimeout());
306 if (config.SilentClose()) { 305 if (config.SilentClose()) {
307 idle_timeout_connection_close_behavior_ = 306 idle_timeout_connection_close_behavior_ =
308 ConnectionCloseBehavior::SILENT_CLOSE; 307 ConnectionCloseBehavior::SILENT_CLOSE;
309 } 308 }
310 if (FLAGS_quic_reloadable_flag_quic_enable_multipath &&
311 config.MultipathEnabled()) {
312 multipath_enabled_ = true;
313 }
314 } else { 309 } else {
315 SetNetworkTimeouts(config.max_time_before_crypto_handshake(), 310 SetNetworkTimeouts(config.max_time_before_crypto_handshake(),
316 config.max_idle_time_before_crypto_handshake()); 311 config.max_idle_time_before_crypto_handshake());
317 } 312 }
318 313
319 sent_packet_manager_.SetFromConfig(config); 314 sent_packet_manager_.SetFromConfig(config);
320 if (config.HasReceivedBytesForConnectionId() && 315 if (config.HasReceivedBytesForConnectionId() &&
321 can_truncate_connection_ids_) { 316 can_truncate_connection_ids_) {
322 packet_generator_.SetConnectionIdLength( 317 packet_generator_.SetConnectionIdLength(
323 config.ReceivedBytesForConnectionId()); 318 config.ReceivedBytesForConnectionId());
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 897 }
903 QUIC_DLOG(INFO) << ENDPOINT 898 QUIC_DLOG(INFO) << ENDPOINT
904 << "BLOCKED_FRAME received for stream: " << frame.stream_id; 899 << "BLOCKED_FRAME received for stream: " << frame.stream_id;
905 visitor_->OnBlockedFrame(frame); 900 visitor_->OnBlockedFrame(frame);
906 visitor_->PostProcessAfterData(); 901 visitor_->PostProcessAfterData();
907 stats_.blocked_frames_received++; 902 stats_.blocked_frames_received++;
908 should_last_packet_instigate_acks_ = true; 903 should_last_packet_instigate_acks_ = true;
909 return connected_; 904 return connected_;
910 } 905 }
911 906
912 bool QuicConnection::OnPathCloseFrame(const QuicPathCloseFrame& frame) {
913 DCHECK(connected_);
914 if (debug_visitor_ != nullptr) {
915 debug_visitor_->OnPathCloseFrame(frame);
916 }
917 QUIC_DLOG(INFO) << ENDPOINT
918 << "PATH_CLOSE_FRAME received for path: " << frame.path_id;
919 return connected_;
920 }
921
922 void QuicConnection::OnPacketComplete() { 907 void QuicConnection::OnPacketComplete() {
923 // Don't do anything if this packet closed the connection. 908 // Don't do anything if this packet closed the connection.
924 if (!connected_) { 909 if (!connected_) {
925 ClearLastFrames(); 910 ClearLastFrames();
926 return; 911 return;
927 } 912 }
928 913
929 QUIC_DVLOG(1) << ENDPOINT << "Got packet " << last_header_.packet_number 914 QUIC_DVLOG(1) << ENDPOINT << "Got packet " << last_header_.packet_number
930 << " for " << last_header_.public_header.connection_id; 915 << " for " << last_header_.public_header.connection_id;
931 916
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 if (!Near(header.packet_number, last_header_.packet_number)) { 1292 if (!Near(header.packet_number, last_header_.packet_number)) {
1308 QUIC_DLOG(INFO) << ENDPOINT << "Packet " << header.packet_number 1293 QUIC_DLOG(INFO) << ENDPOINT << "Packet " << header.packet_number
1309 << " out of bounds. Discarding"; 1294 << " out of bounds. Discarding";
1310 CloseConnection(QUIC_INVALID_PACKET_HEADER, "Packet number out of bounds.", 1295 CloseConnection(QUIC_INVALID_PACKET_HEADER, "Packet number out of bounds.",
1311 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 1296 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
1312 return false; 1297 return false;
1313 } 1298 }
1314 1299
1315 // Multipath is not enabled, but a packet with multipath flag on is 1300 // Multipath is not enabled, but a packet with multipath flag on is
1316 // received. 1301 // received.
1317 if (!multipath_enabled_ && header.public_header.multipath_flag) { 1302 if (header.public_header.multipath_flag) {
1318 const string error_details = 1303 const string error_details =
1319 "Received a packet with multipath flag but multipath is not enabled."; 1304 "Received a packet with multipath flag but multipath is not enabled.";
1320 QUIC_BUG << error_details; 1305 QUIC_BUG << error_details;
1321 CloseConnection(QUIC_BAD_MULTIPATH_FLAG, error_details, 1306 CloseConnection(QUIC_BAD_MULTIPATH_FLAG, error_details,
1322 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 1307 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
1323 return false; 1308 return false;
1324 } 1309 }
1325 1310
1326 if (version_negotiation_state_ != NEGOTIATED_VERSION) { 1311 if (version_negotiation_state_ != NEGOTIATED_VERSION) {
1327 if (perspective_ == Perspective::IS_SERVER) { 1312 if (perspective_ == Perspective::IS_SERVER) {
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 2386
2402 void QuicConnection::CheckIfApplicationLimited() { 2387 void QuicConnection::CheckIfApplicationLimited() {
2403 if (queued_packets_.empty() && 2388 if (queued_packets_.empty() &&
2404 !sent_packet_manager_.HasPendingRetransmissions() && 2389 !sent_packet_manager_.HasPendingRetransmissions() &&
2405 !visitor_->WillingAndAbleToWrite()) { 2390 !visitor_->WillingAndAbleToWrite()) {
2406 sent_packet_manager_.OnApplicationLimited(); 2391 sent_packet_manager_.OnApplicationLimited();
2407 } 2392 }
2408 } 2393 }
2409 2394
2410 } // namespace net 2395 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698