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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 self_ip_changed_(false), | 265 self_ip_changed_(false), |
266 self_port_changed_(false), | 266 self_port_changed_(false), |
267 can_truncate_connection_ids_(true), | 267 can_truncate_connection_ids_(true), |
268 is_secure_(is_secure) { | 268 is_secure_(is_secure) { |
269 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " | 269 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " |
270 << connection_id; | 270 << connection_id; |
271 framer_.set_visitor(this); | 271 framer_.set_visitor(this); |
272 framer_.set_received_entropy_calculator(&received_packet_manager_); | 272 framer_.set_received_entropy_calculator(&received_packet_manager_); |
273 stats_.connection_creation_time = clock_->ApproximateNow(); | 273 stats_.connection_creation_time = clock_->ApproximateNow(); |
274 sent_packet_manager_.set_network_change_visitor(this); | 274 sent_packet_manager_.set_network_change_visitor(this); |
| 275 if (FLAGS_quic_small_default_packet_size && is_server_) { |
| 276 set_max_packet_length(kDefaultServerMaxPacketSize); |
| 277 } |
275 } | 278 } |
276 | 279 |
277 QuicConnection::~QuicConnection() { | 280 QuicConnection::~QuicConnection() { |
278 if (owns_writer_) { | 281 if (owns_writer_) { |
279 delete writer_; | 282 delete writer_; |
280 } | 283 } |
281 STLDeleteElements(&undecryptable_packets_); | 284 STLDeleteElements(&undecryptable_packets_); |
282 STLDeleteValues(&group_map_); | 285 STLDeleteValues(&group_map_); |
283 for (QueuedPacketList::iterator it = queued_packets_.begin(); | 286 for (QueuedPacketList::iterator it = queued_packets_.begin(); |
284 it != queued_packets_.end(); ++it) { | 287 it != queued_packets_.end(); ++it) { |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 if (serialized_packet.packet == nullptr) { | 1580 if (serialized_packet.packet == nullptr) { |
1578 // We failed to serialize the packet, so close the connection. | 1581 // We failed to serialize the packet, so close the connection. |
1579 // CloseConnection does not send close packet, so no infinite loop here. | 1582 // CloseConnection does not send close packet, so no infinite loop here. |
1580 CloseConnection(QUIC_ENCRYPTION_FAILURE, false); | 1583 CloseConnection(QUIC_ENCRYPTION_FAILURE, false); |
1581 return; | 1584 return; |
1582 } | 1585 } |
1583 if (serialized_packet.retransmittable_frames) { | 1586 if (serialized_packet.retransmittable_frames) { |
1584 serialized_packet.retransmittable_frames-> | 1587 serialized_packet.retransmittable_frames-> |
1585 set_encryption_level(encryption_level_); | 1588 set_encryption_level(encryption_level_); |
1586 | 1589 |
1587 if (FLAGS_quic_ack_notifier_informed_on_serialized) { | 1590 sent_packet_manager_.OnSerializedPacket(serialized_packet); |
1588 sent_packet_manager_.OnSerializedPacket(serialized_packet); | |
1589 } | |
1590 } | 1591 } |
1591 if (serialized_packet.is_fec_packet && fec_alarm_->IsSet()) { | 1592 if (serialized_packet.is_fec_packet && fec_alarm_->IsSet()) { |
1592 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. | 1593 // If an FEC packet is serialized with the FEC alarm set, cancel the alarm. |
1593 fec_alarm_->Cancel(); | 1594 fec_alarm_->Cancel(); |
1594 } | 1595 } |
1595 SendOrQueuePacket(QueuedPacket(serialized_packet, encryption_level_)); | 1596 SendOrQueuePacket(QueuedPacket(serialized_packet, encryption_level_)); |
1596 } | 1597 } |
1597 | 1598 |
1598 void QuicConnection::OnCongestionWindowChange() { | 1599 void QuicConnection::OnCongestionWindowChange() { |
1599 packet_generator_.OnCongestionWindowChange( | 1600 packet_generator_.OnCongestionWindowChange( |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 } | 2099 } |
2099 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2100 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2100 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2101 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2101 return true; | 2102 return true; |
2102 } | 2103 } |
2103 } | 2104 } |
2104 return false; | 2105 return false; |
2105 } | 2106 } |
2106 | 2107 |
2107 } // namespace net | 2108 } // namespace net |
OLD | NEW |