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

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

Issue 1656943004: Remove the flag which disables non NAT address migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113049250
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_flags.h » ('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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 } 1357 }
1358 } 1358 }
1359 1359
1360 bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) { 1360 bool QuicConnection::ProcessValidatedPacket(const QuicPacketHeader& header) {
1361 if (self_ip_changed_ || self_port_changed_) { 1361 if (self_ip_changed_ || self_port_changed_) {
1362 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS, 1362 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS,
1363 "Self address migration is not supported."); 1363 "Self address migration is not supported.");
1364 return false; 1364 return false;
1365 } 1365 }
1366 1366
1367 PeerAddressChangeType type = NO_CHANGE;
1368 if (peer_ip_changed_ || peer_port_changed_) {
1369 type = DeterminePeerAddressChangeType();
1370 if (FLAGS_quic_disable_non_nat_address_migration && type != PORT_CHANGE &&
1371 type != IPV4_SUBNET_CHANGE) {
1372 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS,
1373 "Invalid peer address migration.");
1374 return false;
1375 }
1376 }
1377
1378 if (!Near(header.packet_number, last_header_.packet_number)) { 1367 if (!Near(header.packet_number, last_header_.packet_number)) {
1379 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number 1368 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number
1380 << " out of bounds. Discarding"; 1369 << " out of bounds. Discarding";
1381 SendConnectionCloseWithDetails(QUIC_INVALID_PACKET_HEADER, 1370 SendConnectionCloseWithDetails(QUIC_INVALID_PACKET_HEADER,
1382 "packet number out of bounds"); 1371 "packet number out of bounds");
1383 return false; 1372 return false;
1384 } 1373 }
1385 1374
1386 // If this packet has already been seen, or the sender has told us that it 1375 // If this packet has already been seen, or the sender has told us that it
1387 // will not be retransmitted, then stop processing the packet. 1376 // will not be retransmitted, then stop processing the packet.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 visitor_->OnSuccessfulVersionNegotiation(version()); 1411 visitor_->OnSuccessfulVersionNegotiation(version());
1423 if (debug_visitor_ != nullptr) { 1412 if (debug_visitor_ != nullptr) {
1424 debug_visitor_->OnSuccessfulVersionNegotiation(version()); 1413 debug_visitor_->OnSuccessfulVersionNegotiation(version());
1425 } 1414 }
1426 } 1415 }
1427 } 1416 }
1428 1417
1429 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_); 1418 DCHECK_EQ(NEGOTIATED_VERSION, version_negotiation_state_);
1430 1419
1431 if (peer_ip_changed_ || peer_port_changed_) { 1420 if (peer_ip_changed_ || peer_port_changed_) {
1421 PeerAddressChangeType type = DeterminePeerAddressChangeType();
1432 IPEndPoint old_peer_address = peer_address_; 1422 IPEndPoint old_peer_address = peer_address_;
1433 peer_address_ = IPEndPoint( 1423 peer_address_ = IPEndPoint(
1434 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address().bytes(), 1424 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address().bytes(),
1435 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port()); 1425 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port());
1436 1426
1437 DVLOG(1) << ENDPOINT << "Peer's ip:port changed from " 1427 DVLOG(1) << ENDPOINT << "Peer's ip:port changed from "
1438 << old_peer_address.ToString() << " to " 1428 << old_peer_address.ToString() << " to "
1439 << peer_address_.ToString() << ", migrating connection."; 1429 << peer_address_.ToString() << ", migrating connection.";
1440 1430
1441 visitor_->OnConnectionMigration(); 1431 visitor_->OnConnectionMigration();
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 void QuicConnection::OnPathClosed(QuicPathId path_id) { 2444 void QuicConnection::OnPathClosed(QuicPathId path_id) {
2455 // Stop receiving packets on this path. 2445 // Stop receiving packets on this path.
2456 framer_.OnPathClosed(path_id); 2446 framer_.OnPathClosed(path_id);
2457 } 2447 }
2458 2448
2459 bool QuicConnection::ack_frame_updated() const { 2449 bool QuicConnection::ack_frame_updated() const {
2460 return received_packet_manager_.ack_frame_updated(); 2450 return received_packet_manager_.ack_frame_updated();
2461 } 2451 }
2462 2452
2463 } // namespace net 2453 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698