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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 180 } |
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_35) { | 190 if (version < QUIC_VERSION_32) { |
| 191 if (!FLAGS_quic_disable_pre_32) { |
| 192 filtered_versions.push_back(version); |
| 193 } |
| 194 } else if (version == QUIC_VERSION_35) { |
191 if (FLAGS_quic_enable_version_35) { | 195 if (FLAGS_quic_enable_version_35) { |
192 filtered_versions.push_back(version); | 196 filtered_versions.push_back(version); |
193 } | 197 } |
194 } else if (version == QUIC_VERSION_36) { | 198 } else if (version == QUIC_VERSION_36) { |
195 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { | 199 if (FLAGS_quic_enable_version_35 && FLAGS_quic_enable_version_36_v2) { |
196 filtered_versions.push_back(version); | 200 filtered_versions.push_back(version); |
197 } | 201 } |
198 } else { | 202 } else { |
199 filtered_versions.push_back(version); | 203 filtered_versions.push_back(version); |
200 } | 204 } |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 846 |
843 StringPiece QuicPacket::Plaintext(QuicVersion version) const { | 847 StringPiece QuicPacket::Plaintext(QuicVersion version) const { |
844 const size_t start_of_encrypted_data = GetStartOfEncryptedData( | 848 const size_t start_of_encrypted_data = GetStartOfEncryptedData( |
845 version, connection_id_length_, includes_version_, includes_path_id_, | 849 version, connection_id_length_, includes_version_, includes_path_id_, |
846 includes_diversification_nonce_, packet_number_length_); | 850 includes_diversification_nonce_, packet_number_length_); |
847 return StringPiece(data() + start_of_encrypted_data, | 851 return StringPiece(data() + start_of_encrypted_data, |
848 length() - start_of_encrypted_data); | 852 length() - start_of_encrypted_data); |
849 } | 853 } |
850 | 854 |
851 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) | 855 QuicVersionManager::QuicVersionManager(QuicVersionVector supported_versions) |
852 : enable_quic_version_35_(FLAGS_quic_enable_version_35), | 856 : disable_pre_32_(FLAGS_quic_disable_pre_32), |
853 enable_quic_version_36_(FLAGS_quic_enable_version_36_v2), | 857 enable_version_35_(FLAGS_quic_enable_version_35), |
| 858 enable_version_36_(FLAGS_quic_enable_version_36_v2), |
854 allowed_supported_versions_(supported_versions), | 859 allowed_supported_versions_(supported_versions), |
855 filtered_supported_versions_( | 860 filtered_supported_versions_( |
856 FilterSupportedVersions(supported_versions)) {} | 861 FilterSupportedVersions(supported_versions)) {} |
857 | 862 |
| 863 QuicVersionManager::~QuicVersionManager() {} |
| 864 |
858 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { | 865 const QuicVersionVector& QuicVersionManager::GetSupportedVersions() { |
859 if (enable_quic_version_35_ != FLAGS_quic_enable_version_35 || | 866 if (disable_pre_32_ != FLAGS_quic_disable_pre_32 || |
860 enable_quic_version_36_ != FLAGS_quic_enable_version_36_v2) { | 867 enable_version_35_ != FLAGS_quic_enable_version_35 || |
861 enable_quic_version_35_ = FLAGS_quic_enable_version_35; | 868 enable_version_36_ != FLAGS_quic_enable_version_36_v2) { |
862 enable_quic_version_36_ = FLAGS_quic_enable_version_36_v2; | 869 disable_pre_32_ = FLAGS_quic_disable_pre_32; |
| 870 enable_version_35_ = FLAGS_quic_enable_version_35; |
| 871 enable_version_36_ = FLAGS_quic_enable_version_36_v2; |
863 filtered_supported_versions_ = | 872 filtered_supported_versions_ = |
864 FilterSupportedVersions(allowed_supported_versions_); | 873 FilterSupportedVersions(allowed_supported_versions_); |
865 } | 874 } |
866 return filtered_supported_versions_; | 875 return filtered_supported_versions_; |
867 } | 876 } |
868 | 877 |
869 QuicVersionManager::~QuicVersionManager() {} | |
870 | |
871 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, | 878 AckListenerWrapper::AckListenerWrapper(QuicAckListenerInterface* listener, |
872 QuicPacketLength data_length) | 879 QuicPacketLength data_length) |
873 : ack_listener(listener), length(data_length) { | 880 : ack_listener(listener), length(data_length) { |
874 DCHECK(listener != nullptr); | 881 DCHECK(listener != nullptr); |
875 } | 882 } |
876 | 883 |
877 AckListenerWrapper::AckListenerWrapper(const AckListenerWrapper& other) = | 884 AckListenerWrapper::AckListenerWrapper(const AckListenerWrapper& other) = |
878 default; | 885 default; |
879 | 886 |
880 AckListenerWrapper::~AckListenerWrapper() {} | 887 AckListenerWrapper::~AckListenerWrapper() {} |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 is_unackable(false), | 941 is_unackable(false), |
935 has_crypto_handshake(has_crypto_handshake), | 942 has_crypto_handshake(has_crypto_handshake), |
936 num_padding_bytes(num_padding_bytes), | 943 num_padding_bytes(num_padding_bytes), |
937 retransmission(0) {} | 944 retransmission(0) {} |
938 | 945 |
939 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; | 946 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; |
940 | 947 |
941 TransmissionInfo::~TransmissionInfo() {} | 948 TransmissionInfo::~TransmissionInfo() {} |
942 | 949 |
943 } // namespace net | 950 } // namespace net |
OLD | NEW |