| 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" |
| 11 #include "net/quic/crypto/crypto_protocol.h" | 11 #include "net/quic/crypto/crypto_protocol.h" |
| 12 #include "net/quic/quic_flags.h" | |
| 13 #include "net/quic/quic_utils.h" | 12 #include "net/quic/quic_utils.h" |
| 14 | 13 |
| 15 using std::min; | 14 using std::min; |
| 16 using std::string; | 15 using std::string; |
| 17 | 16 |
| 18 namespace net { | 17 namespace net { |
| 19 | 18 |
| 20 // Reads the value corresponding to |name_| from |msg| into |out|. If the | 19 // Reads the value corresponding to |name_| from |msg| into |out|. If the |
| 21 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set | 20 // |name_| is absent in |msg| and |presence| is set to OPTIONAL |out| is set |
| 22 // to |default_value|. | 21 // to |default_value|. |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 } | 586 } |
| 588 | 587 |
| 589 uint32 QuicConfig::ReceivedSocketReceiveBuffer() const { | 588 uint32 QuicConfig::ReceivedSocketReceiveBuffer() const { |
| 590 return socket_receive_buffer_.GetReceivedValue(); | 589 return socket_receive_buffer_.GetReceivedValue(); |
| 591 } | 590 } |
| 592 | 591 |
| 593 bool QuicConfig::negotiated() const { | 592 bool QuicConfig::negotiated() const { |
| 594 // TODO(ianswett): Add the negotiated parameters once and iterate over all | 593 // TODO(ianswett): Add the negotiated parameters once and iterate over all |
| 595 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 594 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
| 596 // ProcessServerHello. | 595 // ProcessServerHello. |
| 597 return congestion_feedback_.negotiated() && | 596 return idle_connection_state_lifetime_seconds_.negotiated() && |
| 598 idle_connection_state_lifetime_seconds_.negotiated() && | 597 max_streams_per_connection_.negotiated(); |
| 599 max_streams_per_connection_.negotiated(); | |
| 600 } | 598 } |
| 601 | 599 |
| 602 void QuicConfig::SetDefaults() { | 600 void QuicConfig::SetDefaults() { |
| 603 QuicTagVector congestion_feedback; | 601 QuicTagVector congestion_feedback; |
| 604 // TODO(alyssar) stop sending this once QUIC_VERSION_23 is sunset. | 602 // 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 | 603 // 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 | 604 // QUIC_VERSION_23 is sunset, no users of QUIC_VERSION_24 should be expecting |
| 607 // it. | 605 // it. |
| 608 congestion_feedback.push_back(kQBIC); | 606 congestion_feedback.push_back(kQBIC); |
| 609 congestion_feedback_.set(congestion_feedback, kQBIC); | 607 congestion_feedback_.set(congestion_feedback, kQBIC); |
| 610 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, | 608 idle_connection_state_lifetime_seconds_.set(kMaximumIdleTimeoutSecs, |
| 611 kDefaultIdleTimeoutSecs); | 609 kDefaultIdleTimeoutSecs); |
| 612 if (FLAGS_quic_allow_silent_close) { | 610 silent_close_.set(1, 0); |
| 613 silent_close_.set(1, 0); | |
| 614 } else { | |
| 615 silent_close_.set(0, 0); | |
| 616 } | |
| 617 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, | 611 SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection, |
| 618 kDefaultMaxStreamsPerConnection); | 612 kDefaultMaxStreamsPerConnection); |
| 619 max_time_before_crypto_handshake_ = | 613 max_time_before_crypto_handshake_ = |
| 620 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); | 614 QuicTime::Delta::FromSeconds(kMaxTimeForCryptoHandshakeSecs); |
| 621 max_idle_time_before_crypto_handshake_ = | 615 max_idle_time_before_crypto_handshake_ = |
| 622 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); | 616 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs); |
| 623 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; | 617 max_undecryptable_packets_ = kDefaultMaxUndecryptablePackets; |
| 624 | 618 |
| 625 SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow); | 619 SetInitialStreamFlowControlWindowToSend(kMinimumFlowControlSendWindow); |
| 626 SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow); | 620 SetInitialSessionFlowControlWindowToSend(kMinimumFlowControlSendWindow); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 640 } | 634 } |
| 641 | 635 |
| 642 QuicErrorCode QuicConfig::ProcessPeerHello( | 636 QuicErrorCode QuicConfig::ProcessPeerHello( |
| 643 const CryptoHandshakeMessage& peer_hello, | 637 const CryptoHandshakeMessage& peer_hello, |
| 644 HelloType hello_type, | 638 HelloType hello_type, |
| 645 string* error_details) { | 639 string* error_details) { |
| 646 DCHECK(error_details != nullptr); | 640 DCHECK(error_details != nullptr); |
| 647 | 641 |
| 648 QuicErrorCode error = QUIC_NO_ERROR; | 642 QuicErrorCode error = QUIC_NO_ERROR; |
| 649 if (error == QUIC_NO_ERROR) { | 643 if (error == QUIC_NO_ERROR) { |
| 650 error = congestion_feedback_.ProcessPeerHello( | |
| 651 peer_hello, hello_type, error_details); | |
| 652 } | |
| 653 if (error == QUIC_NO_ERROR) { | |
| 654 error = idle_connection_state_lifetime_seconds_.ProcessPeerHello( | 644 error = idle_connection_state_lifetime_seconds_.ProcessPeerHello( |
| 655 peer_hello, hello_type, error_details); | 645 peer_hello, hello_type, error_details); |
| 656 } | 646 } |
| 657 if (error == QUIC_NO_ERROR) { | 647 if (error == QUIC_NO_ERROR) { |
| 658 error = | 648 error = |
| 659 silent_close_.ProcessPeerHello(peer_hello, hello_type, error_details); | 649 silent_close_.ProcessPeerHello(peer_hello, hello_type, error_details); |
| 660 } | 650 } |
| 661 if (error == QUIC_NO_ERROR) { | 651 if (error == QUIC_NO_ERROR) { |
| 662 error = max_streams_per_connection_.ProcessPeerHello( | 652 error = max_streams_per_connection_.ProcessPeerHello( |
| 663 peer_hello, hello_type, error_details); | 653 peer_hello, hello_type, error_details); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 683 peer_hello, hello_type, error_details); | 673 peer_hello, hello_type, error_details); |
| 684 } | 674 } |
| 685 if (error == QUIC_NO_ERROR) { | 675 if (error == QUIC_NO_ERROR) { |
| 686 error = connection_options_.ProcessPeerHello( | 676 error = connection_options_.ProcessPeerHello( |
| 687 peer_hello, hello_type, error_details); | 677 peer_hello, hello_type, error_details); |
| 688 } | 678 } |
| 689 return error; | 679 return error; |
| 690 } | 680 } |
| 691 | 681 |
| 692 } // namespace net | 682 } // namespace net |
| OLD | NEW |