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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and | 639 // of them in negotiated, ToHandshakeMessage, ProcessClientHello, and |
640 // ProcessServerHello. | 640 // ProcessServerHello. |
641 return congestion_feedback_.negotiated() && | 641 return congestion_feedback_.negotiated() && |
642 idle_connection_state_lifetime_seconds_.negotiated() && | 642 idle_connection_state_lifetime_seconds_.negotiated() && |
643 keepalive_timeout_seconds_.negotiated() && | 643 keepalive_timeout_seconds_.negotiated() && |
644 max_streams_per_connection_.negotiated(); | 644 max_streams_per_connection_.negotiated(); |
645 } | 645 } |
646 | 646 |
647 void QuicConfig::SetDefaults() { | 647 void QuicConfig::SetDefaults() { |
648 QuicTagVector congestion_feedback; | 648 QuicTagVector congestion_feedback; |
649 if (FLAGS_enable_quic_pacing) { | |
650 congestion_feedback.push_back(kPACE); | |
651 } | |
652 congestion_feedback.push_back(kQBIC); | 649 congestion_feedback.push_back(kQBIC); |
653 congestion_feedback_.set(congestion_feedback, kQBIC); | 650 congestion_feedback_.set(congestion_feedback, kQBIC); |
654 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, | 651 idle_connection_state_lifetime_seconds_.set(kDefaultTimeoutSecs, |
655 kDefaultInitialTimeoutSecs); | 652 kDefaultInitialTimeoutSecs); |
656 // kKATO is optional. Return 0 if not negotiated. | 653 // kKATO is optional. Return 0 if not negotiated. |
657 keepalive_timeout_seconds_.set(0, 0); | 654 keepalive_timeout_seconds_.set(0, 0); |
658 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, | 655 max_streams_per_connection_.set(kDefaultMaxStreamsPerConnection, |
659 kDefaultMaxStreamsPerConnection); | 656 kDefaultMaxStreamsPerConnection); |
660 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( | 657 max_time_before_crypto_handshake_ = QuicTime::Delta::FromSeconds( |
661 kDefaultMaxTimeForCryptoHandshakeSecs); | 658 kDefaultMaxTimeForCryptoHandshakeSecs); |
662 | 659 |
663 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 660 SetInitialFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
664 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 661 SetInitialStreamFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
665 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); | 662 SetInitialSessionFlowControlWindowToSend(kDefaultFlowControlSendWindow); |
666 } | 663 } |
667 | 664 |
668 void QuicConfig::EnablePacing(bool enable_pacing) { | |
669 QuicTagVector congestion_feedback; | |
670 if (enable_pacing) { | |
671 congestion_feedback.push_back(kPACE); | |
672 } | |
673 congestion_feedback.push_back(kQBIC); | |
674 congestion_feedback_.set(congestion_feedback, kQBIC); | |
675 } | |
676 | |
677 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { | 665 void QuicConfig::ToHandshakeMessage(CryptoHandshakeMessage* out) const { |
678 congestion_feedback_.ToHandshakeMessage(out); | 666 congestion_feedback_.ToHandshakeMessage(out); |
679 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); | 667 idle_connection_state_lifetime_seconds_.ToHandshakeMessage(out); |
680 keepalive_timeout_seconds_.ToHandshakeMessage(out); | 668 keepalive_timeout_seconds_.ToHandshakeMessage(out); |
681 max_streams_per_connection_.ToHandshakeMessage(out); | 669 max_streams_per_connection_.ToHandshakeMessage(out); |
682 initial_congestion_window_.ToHandshakeMessage(out); | 670 initial_congestion_window_.ToHandshakeMessage(out); |
683 initial_round_trip_time_us_.ToHandshakeMessage(out); | 671 initial_round_trip_time_us_.ToHandshakeMessage(out); |
684 loss_detection_.ToHandshakeMessage(out); | 672 loss_detection_.ToHandshakeMessage(out); |
685 initial_flow_control_window_bytes_.ToHandshakeMessage(out); | 673 initial_flow_control_window_bytes_.ToHandshakeMessage(out); |
686 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); | 674 initial_stream_flow_control_window_bytes_.ToHandshakeMessage(out); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 peer_hello, hello_type, error_details); | 729 peer_hello, hello_type, error_details); |
742 } | 730 } |
743 if (error == QUIC_NO_ERROR) { | 731 if (error == QUIC_NO_ERROR) { |
744 error = connection_options_.ProcessPeerHello( | 732 error = connection_options_.ProcessPeerHello( |
745 peer_hello, hello_type, error_details); | 733 peer_hello, hello_type, error_details); |
746 } | 734 } |
747 return error; | 735 return error; |
748 } | 736 } |
749 | 737 |
750 } // namespace net | 738 } // namespace net |
OLD | NEW |