OLD | NEW |
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 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 } | 1450 } |
1451 } | 1451 } |
1452 | 1452 |
1453 void QuicConnection::WriteIfNotBlocked() { | 1453 void QuicConnection::WriteIfNotBlocked() { |
1454 if (!writer_->IsWriteBlocked()) { | 1454 if (!writer_->IsWriteBlocked()) { |
1455 OnCanWrite(); | 1455 OnCanWrite(); |
1456 } | 1456 } |
1457 } | 1457 } |
1458 | 1458 |
1459 bool QuicConnection::ProcessValidatedPacket() { | 1459 bool QuicConnection::ProcessValidatedPacket() { |
1460 if ((peer_ip_changed_ && !FLAGS_quic_allow_ip_migration) || | 1460 if (self_ip_changed_ || self_port_changed_) { |
1461 self_ip_changed_ || self_port_changed_) { | 1461 SendConnectionCloseWithDetails(QUIC_ERROR_MIGRATING_ADDRESS, |
1462 SendConnectionCloseWithDetails( | 1462 "Self address migration is not supported."); |
1463 QUIC_ERROR_MIGRATING_ADDRESS, | |
1464 "Neither IP address migration, nor self port migration are supported."); | |
1465 return false; | 1463 return false; |
1466 } | 1464 } |
1467 | 1465 |
1468 // TODO(fayang): Use peer_address_changed_ instead of peer_ip_changed_ and | 1466 // TODO(fayang): Use peer_address_changed_ instead of peer_ip_changed_ and |
1469 // peer_port_changed_ once FLAGS_quic_allow_ip_migration is deprecated. | 1467 // peer_port_changed_ once FLAGS_quic_allow_ip_migration is deprecated. |
1470 if (peer_ip_changed_ || peer_port_changed_) { | 1468 if (peer_ip_changed_ || peer_port_changed_) { |
1471 IPEndPoint old_peer_address = peer_address_; | 1469 IPEndPoint old_peer_address = peer_address_; |
1472 peer_address_ = IPEndPoint( | 1470 peer_address_ = IPEndPoint( |
1473 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address(), | 1471 peer_ip_changed_ ? migrating_peer_ip_ : peer_address_.address(), |
1474 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port()); | 1472 peer_port_changed_ ? migrating_peer_port_ : peer_address_.port()); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 return false; | 1606 return false; |
1609 } | 1607 } |
1610 delete packet->serialized_packet.retransmittable_frames; | 1608 delete packet->serialized_packet.retransmittable_frames; |
1611 delete packet->serialized_packet.packet; | 1609 delete packet->serialized_packet.packet; |
1612 packet->serialized_packet.retransmittable_frames = nullptr; | 1610 packet->serialized_packet.retransmittable_frames = nullptr; |
1613 packet->serialized_packet.packet = nullptr; | 1611 packet->serialized_packet.packet = nullptr; |
1614 return true; | 1612 return true; |
1615 } | 1613 } |
1616 | 1614 |
1617 bool QuicConnection::WritePacketInner(QueuedPacket* packet) { | 1615 bool QuicConnection::WritePacketInner(QueuedPacket* packet) { |
| 1616 if (FLAGS_quic_close_connection_out_of_order_sending && |
| 1617 packet->serialized_packet.packet_number < |
| 1618 sent_packet_manager_.largest_sent_packet()) { |
| 1619 LOG(DFATAL) << "Attempt to write packet:" |
| 1620 << packet->serialized_packet.packet_number |
| 1621 << " after:" << sent_packet_manager_.largest_sent_packet(); |
| 1622 SendConnectionCloseWithDetails(QUIC_INTERNAL_ERROR, |
| 1623 "Packet written out of order."); |
| 1624 return true; |
| 1625 } |
1618 if (ShouldDiscardPacket(*packet)) { | 1626 if (ShouldDiscardPacket(*packet)) { |
1619 ++stats_.packets_discarded; | 1627 ++stats_.packets_discarded; |
1620 return true; | 1628 return true; |
1621 } | 1629 } |
1622 // Connection close packets are encrypted and saved, so don't exit early. | 1630 // Connection close packets are encrypted and saved, so don't exit early. |
1623 const bool is_connection_close = IsConnectionClose(*packet); | 1631 const bool is_connection_close = IsConnectionClose(*packet); |
1624 if (writer_->IsWriteBlocked() && !is_connection_close) { | 1632 if (writer_->IsWriteBlocked() && !is_connection_close) { |
1625 return false; | 1633 return false; |
1626 } | 1634 } |
1627 | 1635 |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2404 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
2397 ++mtu_probe_count_; | 2405 ++mtu_probe_count_; |
2398 | 2406 |
2399 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2407 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
2400 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2408 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2401 | 2409 |
2402 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2410 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2403 } | 2411 } |
2404 | 2412 |
2405 } // namespace net | 2413 } // namespace net |
OLD | NEW |