| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 max_undecryptable_packets_(0), |
| 431 congestion_feedback_(kCGST, PRESENCE_REQUIRED), | 431 congestion_feedback_(kCGST, PRESENCE_OPTIONAL), |
| 432 connection_options_(kCOPT, PRESENCE_OPTIONAL), | 432 connection_options_(kCOPT, PRESENCE_OPTIONAL), |
| 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), | 433 idle_connection_state_lifetime_seconds_(kICSL, PRESENCE_REQUIRED), |
| 434 silent_close_(kSCLS, PRESENCE_OPTIONAL), | 434 silent_close_(kSCLS, PRESENCE_OPTIONAL), |
| 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), | 435 max_streams_per_connection_(kMSPC, PRESENCE_REQUIRED), |
| 436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), | 436 bytes_for_connection_id_(kTCID, PRESENCE_OPTIONAL), |
| 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), | 437 initial_round_trip_time_us_(kIRTT, PRESENCE_OPTIONAL), |
| 438 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), | 438 initial_stream_flow_control_window_bytes_(kSFCW, PRESENCE_OPTIONAL), |
| 439 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), | 439 initial_session_flow_control_window_bytes_(kCFCW, PRESENCE_OPTIONAL), |
| 440 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { | 440 socket_receive_buffer_(kSRBF, PRESENCE_OPTIONAL) { |
| 441 SetDefaults(); | 441 SetDefaults(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 QuicConfig::~QuicConfig() {} | 444 QuicConfig::~QuicConfig() {} |
| 445 | 445 |
| 446 void QuicConfig::SetCongestionFeedback( | |
| 447 const QuicTagVector& congestion_feedback, | |
| 448 QuicTag default_congestion_feedback) { | |
| 449 congestion_feedback_.set(congestion_feedback, default_congestion_feedback); | |
| 450 } | |
| 451 | |
| 452 QuicTag QuicConfig::CongestionFeedback() const { | |
| 453 return congestion_feedback_.GetTag(); | |
| 454 } | |
| 455 | |
| 456 void QuicConfig::SetConnectionOptionsToSend( | 446 void QuicConfig::SetConnectionOptionsToSend( |
| 457 const QuicTagVector& connection_options) { | 447 const QuicTagVector& connection_options) { |
| 458 connection_options_.SetSendValues(connection_options); | 448 connection_options_.SetSendValues(connection_options); |
| 459 } | 449 } |
| 460 | 450 |
| 461 bool QuicConfig::HasReceivedConnectionOptions() const { | 451 bool QuicConfig::HasReceivedConnectionOptions() const { |
| 462 return connection_options_.HasReceivedValues(); | 452 return connection_options_.HasReceivedValues(); |
| 463 } | 453 } |
| 464 | 454 |
| 465 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { | 455 QuicTagVector QuicConfig::ReceivedConnectionOptions() const { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 594 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
| 605 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 595 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
| 606 // ProcessServerHello. | 596 // ProcessServerHello. |
| 607 return congestion_feedback_.negotiated() && | 597 return congestion_feedback_.negotiated() && |
| 608 idle_connection_state_lifetime_seconds_.negotiated() && | 598 idle_connection_state_lifetime_seconds_.negotiated() && |
| 609 max_streams_per_connection_.negotiated(); | 599 max_streams_per_connection_.negotiated(); |
| 610 } | 600 } |
| 611 | 601 |
| 612 void QuicConfig::SetDefaults() { | 602 void QuicConfig::SetDefaults() { |
| 613 QuicTagVector congestion_feedback; | 603 QuicTagVector congestion_feedback; |
| 604 // TODO(alyssar) stop sending this once QUIC_VERSION_23 is sunset. |
| 605 // This field was required until version 22 was removed but by the time |
| 606 // QUIC_VERSION_23 is sunset, no users of QUIC_VERSION_24 should be expecting |
| 607 // it. |
| 614 congestion_feedback.push_back(kQBIC); | 608 congestion_feedback.push_back(kQBIC); |
| 615 congestion_feedback_.set(congestion_feedback, kQBIC); | 609 congestion_feedback_.set(congestion_feedback, kQBIC); |
| 616 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, | 610 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, |
| 617 kDefaultIdleTimeoutSecs); | 611 kDefaultIdleTimeoutSecs); |
| 618 if (FLAGS_quic_allow_silent_close) { | 612 if (FLAGS_quic_allow_silent_close) { |
| 619 silent_close_.set(1, 0); | 613 silent_close_.set(1, 0); |
| 620 } else { | 614 } else { |
| 621 silent_close_.set(0, 0); | 615 silent_close_.set(0, 0); |
| 622 } | 616 } |
| 623 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, | 617 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 peer_hello, hello_type, error_details); | 683 peer_hello, hello_type, error_details); |
| 690 } | 684 } |
| 691 if (error == QUIC_NO_ERROR) { | 685 if (error == QUIC_NO_ERROR) { |
| 692 error = connection_options_.ProcessPeerHello( | 686 error = connection_options_.ProcessPeerHello( |
| 693 peer_hello, hello_type, error_details); | 687 peer_hello, hello_type, error_details); |
| 694 } | 688 } |
| 695 return error; | 689 return error; |
| 696 } | 690 } |
| 697 | 691 |
| 698 } // namespace net | 692 } // namespace net |
| OLD | NEW |