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 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 // Clone the packet so it's owned in the future. | 1516 // Clone the packet so it's owned in the future. |
1517 connection_close_packet_.reset(encrypted->Clone()); | 1517 connection_close_packet_.reset(encrypted->Clone()); |
1518 // This assures we won't try to write *forced* packets when blocked. | 1518 // This assures we won't try to write *forced* packets when blocked. |
1519 // Return true to stop processing. | 1519 // Return true to stop processing. |
1520 if (writer_->IsWriteBlocked()) { | 1520 if (writer_->IsWriteBlocked()) { |
1521 visitor_->OnWriteBlocked(); | 1521 visitor_->OnWriteBlocked(); |
1522 return true; | 1522 return true; |
1523 } | 1523 } |
1524 } | 1524 } |
1525 | 1525 |
1526 if (!FLAGS_quic_allow_oversized_packets_for_test) { | 1526 DCHECK_LE(encrypted->length(), kMaxPacketSize); |
1527 DCHECK_LE(encrypted->length(), kMaxPacketSize); | |
1528 } | |
1529 DCHECK_LE(encrypted->length(), packet_generator_.GetMaxPacketLength()); | 1527 DCHECK_LE(encrypted->length(), packet_generator_.GetMaxPacketLength()); |
1530 DVLOG(1) << ENDPOINT << "Sending packet " << packet_number << " : " | 1528 DVLOG(1) << ENDPOINT << "Sending packet " << packet_number << " : " |
1531 << (packet->serialized_packet.is_fec_packet | 1529 << (packet->serialized_packet.is_fec_packet |
1532 ? "FEC " | 1530 ? "FEC " |
1533 : (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA | 1531 : (IsRetransmittable(*packet) == HAS_RETRANSMITTABLE_DATA |
1534 ? "data bearing " | 1532 ? "data bearing " |
1535 : " ack only ")) | 1533 : " ack only ")) |
1536 << ", encryption level: " | 1534 << ", encryption level: " |
1537 << QuicUtils::EncryptionLevelToString(packet->encryption_level) | 1535 << QuicUtils::EncryptionLevelToString(packet->encryption_level) |
1538 << ", encrypted length:" << encrypted->length(); | 1536 << ", encrypted length:" << encrypted->length(); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2244 } | 2242 } |
2245 return false; | 2243 return false; |
2246 } | 2244 } |
2247 | 2245 |
2248 void QuicConnection::SetMtuDiscoveryTarget(QuicByteCount target) { | 2246 void QuicConnection::SetMtuDiscoveryTarget(QuicByteCount target) { |
2249 mtu_discovery_target_ = LimitMaxPacketSize(target); | 2247 mtu_discovery_target_ = LimitMaxPacketSize(target); |
2250 } | 2248 } |
2251 | 2249 |
2252 QuicByteCount QuicConnection::LimitMaxPacketSize( | 2250 QuicByteCount QuicConnection::LimitMaxPacketSize( |
2253 QuicByteCount suggested_max_packet_size) { | 2251 QuicByteCount suggested_max_packet_size) { |
2254 if (FLAGS_quic_allow_oversized_packets_for_test) { | |
2255 return suggested_max_packet_size; | |
2256 } | |
2257 | |
2258 if (peer_address_.address().empty()) { | 2252 if (peer_address_.address().empty()) { |
2259 LOG(DFATAL) << "Attempted to use a connection without a valid peer address"; | 2253 LOG(DFATAL) << "Attempted to use a connection without a valid peer address"; |
2260 return suggested_max_packet_size; | 2254 return suggested_max_packet_size; |
2261 } | 2255 } |
2262 | 2256 |
2263 const QuicByteCount writer_limit = writer_->GetMaxPacketSize(peer_address()); | 2257 const QuicByteCount writer_limit = writer_->GetMaxPacketSize(peer_address()); |
2264 | 2258 |
2265 QuicByteCount max_packet_size = suggested_max_packet_size; | 2259 QuicByteCount max_packet_size = suggested_max_packet_size; |
2266 if (max_packet_size > writer_limit) { | 2260 if (max_packet_size > writer_limit) { |
2267 max_packet_size = writer_limit; | 2261 max_packet_size = writer_limit; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; | 2299 packet_number_of_last_sent_packet_ + packets_between_mtu_probes_ + 1; |
2306 ++mtu_probe_count_; | 2300 ++mtu_probe_count_; |
2307 | 2301 |
2308 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; | 2302 DVLOG(2) << "Sending a path MTU discovery packet #" << mtu_probe_count_; |
2309 SendMtuDiscoveryPacket(mtu_discovery_target_); | 2303 SendMtuDiscoveryPacket(mtu_discovery_target_); |
2310 | 2304 |
2311 DCHECK(!mtu_discovery_alarm_->IsSet()); | 2305 DCHECK(!mtu_discovery_alarm_->IsSet()); |
2312 } | 2306 } |
2313 | 2307 |
2314 } // namespace net | 2308 } // namespace net |
OLD | NEW |