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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 default: | 420 default: |
421 *error_details = "Bad " + QuicUtils::TagToString(tag_); | 421 *error_details = "Bad " + QuicUtils::TagToString(tag_); |
422 break; | 422 break; |
423 } | 423 } |
424 return error; | 424 return error; |
425 } | 425 } |
426 | 426 |
427 QuicConfig::QuicConfig() | 427 QuicConfig::QuicConfig() |
428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 428 : max_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), | 429 max_idle_time_before_crypto_handshake_(QuicTime::Delta::Zero()), |
| 430 max_undecryptable_packets_(0), |
430 congestion_feedback_(kCGST, PRESENCE_REQUIRED), | 431 congestion_feedback_(kCGST, PRESENCE_REQUIRED), |
431 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 432 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
432 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
433 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), | 434 keepalive_timeout_seconds_(kKATO, PRESENCE_OPTIONAL), |
434 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
435 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), | 436 initial_congestion_window_(kSWND, PRESENCE_OPTIONAL), |
436 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
437 // TODO(rjshade): Remove this when retiring QUIC_VERSION_19. | 438 // TODO(rjshade): Remove this when retiring QUIC_VERSION_19. |
438 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), | 439 initial_flow_control_window_bytes_(kIFCW, PRESENCE_OPTIONAL), |
439 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 440 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
440 // QUIC_VERSION_19. | 441 // QUIC_VERSION_19. |
441 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 442 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
442 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring | 443 // TODO(rjshade): Make this PRESENCE_REQUIRED when retiring |
443 // QUIC_VERSION_19. | 444 // QUIC_VERSION_19. |
444 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 445 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
445 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { | 446 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { |
| 447 SetDefaults(); |
446 } | 448 } |
447 | 449 |
448 QuicConfig::~QuicConfig() {} | 450 QuicConfig::~QuicConfig() {} |
449 | 451 |
450 void QuicConfig::SetCongestionFeedback( | 452 void QuicConfig::SetCongestionFeedback( |
451 const QuicTagVector& congestion_feedback, | 453 const QuicTagVector& congestion_feedback, |
452 QuicTag default_congestion_feedback) { | 454 QuicTag default_congestion_feedback) { |
453 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); | 455 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); |
454 } | 456 } |
455 | 457 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, | 638 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, |
637 kDefaultIdleTimeoutSecs); | 639 kDefaultIdleTimeoutSecs); |
638 // kKATO is optional. Return 0 if not negotiated. | 640 // kKATO is optional. Return 0 if not negotiated. |
639 keepalive_timeout_seconds_.set(0, 0); | 641 keepalive_timeout_seconds_.set(0, 0); |
640 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, | 642 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, |
641 kDefaultMaxStreamsPerConnection); | 643 kDefaultMaxStreamsPerConnection); |
642 max_time_before_crypto_handshake_ = | 644 max_time_before_crypto_handshake_ = |
643 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); | 645 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); |
644 max_idle_time_before_crypto_handshake_ = | 646 max_idle_time_before_crypto_handshake_ = |
645 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); | 647 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); |
| 648 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; |
646 | 649 |
647 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 650 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
648 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 651 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
649 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 652 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
650 } | 653 } |
651 | 654 |
652 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 655 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
653 congestion_feedback_.ToHandshakeMessage(out); | 656 congestion_feedback_.ToHandshakeMessage(out); |
654 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 657 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
655 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 658 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 peer_hello, hello_type, error_details); | 714 peer_hello, hello_type, error_details); |
712 } | 715 } |
713 if (error == QUIC_NO_ERROR) { | 716 if (error == QUIC_NO_ERROR) { |
714 error = connection_options_.ProcessPeerHello( | 717 error = connection_options_.ProcessPeerHello( |
715 peer_hello, hello_type, error_details); | 718 peer_hello, hello_type, error_details); |
716 } | 719 } |
717 return error; | 720 return error; |
718 } | 721 } |
719 | 722 |
720 } // namespace net | 723 } // namespace net |
OLD | NEW |