OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/quic_protocol.h" | 5 #include "net/quic/core/quic_protocol.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/core/quic_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
10 #include "net/quic/core/quic_utils.h" | 10 #include "net/quic/core/quic_utils.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 QuicVersionVector CurrentSupportedVersions() { | 182 QuicVersionVector CurrentSupportedVersions() { |
183 return FilterSupportedVersions(AllSupportedVersions()); | 183 return FilterSupportedVersions(AllSupportedVersions()); |
184 } | 184 } |
185 | 185 |
186 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { | 186 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { |
187 QuicVersionVector filtered_versions(versions.size()); | 187 QuicVersionVector filtered_versions(versions.size()); |
188 filtered_versions.clear(); // Guaranteed by spec not to change capacity. | 188 filtered_versions.clear(); // Guaranteed by spec not to change capacity. |
189 for (QuicVersion version : versions) { | 189 for (QuicVersion version : versions) { |
190 if (version < QUIC_VERSION_32) { | 190 if (version < QUIC_VERSION_32) { |
191 if (!FLAGS_quic_disable_pre_32) { | 191 if (!FLAGS_quic_disable_pre_32 && !FLAGS_quic_disable_pre_34) { |
| 192 filtered_versions.push_back(version); |
| 193 } |
| 194 } else if (version < QUIC_VERSION_34) { |
| 195 if (!FLAGS_quic_disable_pre_34) { |
192 filtered_versions.push_back(version); | 196 filtered_versions.push_back(version); |
193 } | 197 } |
194 } else if (version == QUIC_VERSION_35) { | 198 } else if (version == QUIC_VERSION_35) { |
195 if (FLAGS_quic_enable_version_35) { | 199 if (FLAGS_quic_enable_version_35) { |
196 filtered_versions.push_back(version); | 200 filtered_versions.push_back(version); |
197 } | 201 } |
198 } else if (version == QUIC_VERSION_36) { | 202 } else if (version == QUIC_VERSION_36) { |
199 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { | 203 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { |
200 filtered_versions.push_back(version); | 204 filtered_versions.push_back(version); |
201 } | 205 } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 StringPiece QuicPacket::Plaintext(QuicVersion version) const { | 777 StringPiece QuicPacket::Plaintext(QuicVersion version) const { |
774 const size_t start_of_encrypted_data = GetStartOfEncryptedData( | 778 const size_t start_of_encrypted_data = GetStartOfEncryptedData( |
775 version, connection_id_length_, includes_version_, includes_path_id_, | 779 version, connection_id_length_, includes_version_, includes_path_id_, |
776 includes_diversification_nonce_, packet_number_length_); | 780 includes_diversification_nonce_, packet_number_length_); |
777 return StringPiece(data() + start_of_encrypted_data, | 781 return StringPiece(data() + start_of_encrypted_data, |
778 length() - start_of_encrypted_data); | 782 length() - start_of_encrypted_data); |
779 } | 783 } |
780 | 784 |
781 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) | 785 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) |
782 : disable_pre_32_(FLAGS_quic_disable_pre_32), | 786 : disable_pre_32_(FLAGS_quic_disable_pre_32), |
| 787 disable_pre_34_(FLAGS_quic_disable_pre_34), |
783 enable_version_35_(FLAGS_quic_enable_version_35), | 788 enable_version_35_(FLAGS_quic_enable_version_35), |
784 enable_version_36_(FLAGS_quic_enable_version_36_v2), | 789 enable_version_36_(FLAGS_quic_enable_version_36_v2), |
785 allowed_supported_versions_(supported_versions), | 790 allowed_supported_versions_(supported_versions), |
786 filtered_supported_versions_( | 791 filtered_supported_versions_( |
787 FilterSupportedVersions(supported_versions)) {} | 792 FilterSupportedVersions(supported_versions)) {} |
788 | 793 |
789 QuicVersionManager::~QuicVersionManager() {} | 794 QuicVersionManager::~QuicVersionManager() {} |
790 | 795 |
791 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { | 796 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { |
792 if (disable_pre_32_ != FLAGS_quic_disable_pre_32 || | 797 if (disable_pre_32_ != FLAGS_quic_disable_pre_32 || |
| 798 disable_pre_34_ != FLAGS_quic_disable_pre_34 || |
793 enable_version_35_ != FLAGS_quic_enable_version_35 || | 799 enable_version_35_ != FLAGS_quic_enable_version_35 || |
794 enable_version_36_ != FLAGS_quic_enable_version_36_v2) { | 800 enable_version_36_ != FLAGS_quic_enable_version_36_v2) { |
795 disable_pre_32_ = FLAGS_quic_disable_pre_32; | 801 disable_pre_32_ = FLAGS_quic_disable_pre_32; |
| 802 disable_pre_34_ = FLAGS_quic_disable_pre_34; |
796 enable_version_35_ = FLAGS_quic_enable_version_35; | 803 enable_version_35_ = FLAGS_quic_enable_version_35; |
797 enable_version_36_ = FLAGS_quic_enable_version_36_v2; | 804 enable_version_36_ = FLAGS_quic_enable_version_36_v2; |
798 filtered_supported_versions_ = | 805 filtered_supported_versions_ = |
799 FilterSupportedVersions(allowed_supported_versions_); | 806 FilterSupportedVersions(allowed_supported_versions_); |
800 } | 807 } |
801 return filtered_supported_versions_; | 808 return filtered_supported_versions_; |
802 } | 809 } |
803 | 810 |
804 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, | 811 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, |
805 QuicPacketLength data_length) | 812 QuicPacketLength data_length) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 is_unackable(false), | 874 is_unackable(false), |
868 has_crypto_handshake(has_crypto_handshake), | 875 has_crypto_handshake(has_crypto_handshake), |
869 num_padding_bytes(num_padding_bytes), | 876 num_padding_bytes(num_padding_bytes), |
870 retransmission(0) {} | 877 retransmission(0) {} |
871 | 878 |
872 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; | 879 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; |
873 | 880 |
874 TransmissionInfo::~TransmissionInfo() {} | 881 TransmissionInfo::~TransmissionInfo() {} |
875 | 882 |
876 } // namespace net | 883 } // namespace net |
OLD | NEW |