OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_config.h" | 5 #include "net/quic/quic_config.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 336 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
337 max_undecryptable_packets_(0), | 337 max_undecryptable_packets_(0), |
338 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 338 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
339 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 339 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
340 silent_close_(kSCLS, PRESENCE_OPTIONAL), | 340 silent_close_(kSCLS, PRESENCE_OPTIONAL), |
341 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 341 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
342 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), | 342 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), |
343 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 343 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
344 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 344 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
345 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 345 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
346 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { | 346 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL), |
| 347 multipath_enabled_(kMPTH, PRESENCE_OPTIONAL) { |
347 SetDefaults(); | 348 SetDefaults(); |
348 } | 349 } |
349 | 350 |
350 QuicConfig::~QuicConfig() {} | 351 QuicConfig::~QuicConfig() {} |
351 | 352 |
352 bool QuicConfig::SetInitialReceivedConnectionOptions( | 353 bool QuicConfig::SetInitialReceivedConnectionOptions( |
353 const QuicTagVector& tags) { | 354 const QuicTagVector& tags) { |
354 if (HasReceivedConnectionOptions()) { | 355 if (HasReceivedConnectionOptions()) { |
355 // If we have already received connection options (via handshake or due to a | 356 // If we have already received connection options (via handshake or due to a |
356 // previous call), don't re-initialize. | 357 // previous call), don't re-initialize. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 } | 514 } |
514 | 515 |
515 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { | 516 bool QuicConfig::HasReceivedSocketReceiveBuffer() const { |
516 return socket_receive_buffer_.HasReceivedValue(); | 517 return socket_receive_buffer_.HasReceivedValue(); |
517 } | 518 } |
518 | 519 |
519 uint32_t QuicConfig::ReceivedSocketReceiveBuffer() const { | 520 uint32_t QuicConfig::ReceivedSocketReceiveBuffer() const { |
520 return socket_receive_buffer_.GetReceivedValue(); | 521 return socket_receive_buffer_.GetReceivedValue(); |
521 } | 522 } |
522 | 523 |
| 524 void QuicConfig::SetMultipathEnabled(bool multipath_enabled) { |
| 525 uint32_t value = multipath_enabled ? 1 : 0; |
| 526 multipath_enabled_.set(value, value); |
| 527 } |
| 528 |
| 529 bool QuicConfig::MultipathEnabled() const { |
| 530 return multipath_enabled_.GetUint32() > 0; |
| 531 } |
| 532 |
523 bool QuicConfig::negotiated() const { | 533 bool QuicConfig::negotiated() const { |
524 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 534 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
525 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 535 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
526 // ProcessServerHello. | 536 // ProcessServerHello. |
527 return idle_connection_state_lifetime_seconds_.negotiated() && | 537 return idle_connection_state_lifetime_seconds_.negotiated() && |
528 max_streams_per_connection_.negotiated(); | 538 max_streams_per_connection_.negotiated(); |
529 } | 539 } |
530 | 540 |
531 void QuicConfig::SetDefaults() { | 541 void QuicConfig::SetDefaults() { |
532 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, | 542 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 error_details); | 606 error_details); |
597 } | 607 } |
598 if (error == QUIC_NO_ERROR) { | 608 if (error == QUIC_NO_ERROR) { |
599 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, | 609 error = connection_options_.ProcessPeerHello(peer_hello, hello_type, |
600 error_details); | 610 error_details); |
601 } | 611 } |
602 return error; | 612 return error; |
603 } | 613 } |
604 | 614 |
605 } // namespace net | 615 } // namespace net |
OLD | NEW |