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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 sent_packet_manager_( | 225 sent_packet_manager_( |
226 is_server, clock_, &stats_, | 226 is_server, clock_, &stats_, |
227 FLAGS_quic_use_bbr_congestion_control ? kBBR : kCubic, | 227 FLAGS_quic_use_bbr_congestion_control ? kBBR : kCubic, |
228 FLAGS_quic_use_time_loss_detection ? kTime : kNack), | 228 FLAGS_quic_use_time_loss_detection ? kTime : kNack), |
229 version_negotiation_state_(START_NEGOTIATION), | 229 version_negotiation_state_(START_NEGOTIATION), |
230 is_server_(is_server), | 230 is_server_(is_server), |
231 connected_(true), | 231 connected_(true), |
232 peer_ip_changed_(false), | 232 peer_ip_changed_(false), |
233 peer_port_changed_(false), | 233 peer_port_changed_(false), |
234 self_ip_changed_(false), | 234 self_ip_changed_(false), |
235 self_port_changed_(false) { | 235 self_port_changed_(false), |
| 236 can_truncate_connection_ids_(true) { |
236 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " | 237 DVLOG(1) << ENDPOINT << "Created connection with connection_id: " |
237 << connection_id; | 238 << connection_id; |
238 if (!FLAGS_quic_unified_timeouts) { | 239 if (!FLAGS_quic_unified_timeouts) { |
239 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); | 240 timeout_alarm_->Set(clock_->ApproximateNow().Add(idle_network_timeout_)); |
240 } | 241 } |
241 framer_.set_visitor(this); | 242 framer_.set_visitor(this); |
242 framer_.set_received_entropy_calculator(&received_packet_manager_); | 243 framer_.set_received_entropy_calculator(&received_packet_manager_); |
243 stats_.connection_creation_time = clock_->ApproximateNow(); | 244 stats_.connection_creation_time = clock_->ApproximateNow(); |
244 sent_packet_manager_.set_network_change_visitor(this); | 245 sent_packet_manager_.set_network_change_visitor(this); |
245 } | 246 } |
(...skipping 18 matching lines...) Expand all Loading... |
264 config.IdleConnectionStateLifetime()); | 265 config.IdleConnectionStateLifetime()); |
265 } else { | 266 } else { |
266 SetNetworkTimeouts(config.max_time_before_crypto_handshake(), | 267 SetNetworkTimeouts(config.max_time_before_crypto_handshake(), |
267 config.max_idle_time_before_crypto_handshake()); | 268 config.max_idle_time_before_crypto_handshake()); |
268 } | 269 } |
269 } else { | 270 } else { |
270 SetIdleNetworkTimeout(config.IdleConnectionStateLifetime()); | 271 SetIdleNetworkTimeout(config.IdleConnectionStateLifetime()); |
271 } | 272 } |
272 sent_packet_manager_.SetFromConfig(config); | 273 sent_packet_manager_.SetFromConfig(config); |
273 if (FLAGS_allow_truncated_connection_ids_for_quic && | 274 if (FLAGS_allow_truncated_connection_ids_for_quic && |
274 config.HasReceivedBytesForConnectionId()) { | 275 config.HasReceivedBytesForConnectionId() && |
| 276 can_truncate_connection_ids_) { |
275 packet_generator_.SetConnectionIdLength( | 277 packet_generator_.SetConnectionIdLength( |
276 config.ReceivedBytesForConnectionId()); | 278 config.ReceivedBytesForConnectionId()); |
277 } | 279 } |
278 max_undecryptable_packets_ = config.max_undecryptable_packets(); | 280 max_undecryptable_packets_ = config.max_undecryptable_packets(); |
279 } | 281 } |
280 | 282 |
281 bool QuicConnection::SelectMutualVersion( | 283 bool QuicConnection::SelectMutualVersion( |
282 const QuicVersionVector& available_versions) { | 284 const QuicVersionVector& available_versions) { |
283 // Try to find the highest mutual version by iterating over supported | 285 // Try to find the highest mutual version by iterating over supported |
284 // versions, starting with the highest, and breaking out of the loop once we | 286 // versions, starting with the highest, and breaking out of the loop once we |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 } | 2047 } |
2046 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { | 2048 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
2047 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { | 2049 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
2048 return true; | 2050 return true; |
2049 } | 2051 } |
2050 } | 2052 } |
2051 return false; | 2053 return false; |
2052 } | 2054 } |
2053 | 2055 |
2054 } // namespace net | 2056 } // namespace net |
OLD | NEW |