| 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/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "net/quic/quic_flags.h" | 51 #include "net/quic/quic_flags.h" |
| 52 #include "net/quic/quic_http_stream.h" | 52 #include "net/quic/quic_http_stream.h" |
| 53 #include "net/quic/quic_protocol.h" | 53 #include "net/quic/quic_protocol.h" |
| 54 #include "net/quic/quic_server_id.h" | 54 #include "net/quic/quic_server_id.h" |
| 55 #include "net/socket/client_socket_factory.h" | 55 #include "net/socket/client_socket_factory.h" |
| 56 #include "net/socket/socket_performance_watcher.h" | 56 #include "net/socket/socket_performance_watcher.h" |
| 57 #include "net/socket/socket_performance_watcher_factory.h" | 57 #include "net/socket/socket_performance_watcher_factory.h" |
| 58 #include "net/ssl/token_binding.h" | 58 #include "net/ssl/token_binding.h" |
| 59 #include "net/udp/udp_client_socket.h" | 59 #include "net/udp/udp_client_socket.h" |
| 60 | 60 |
| 61 #if defined(OS_WIN) | |
| 62 #include "base/win/windows_version.h" | |
| 63 #endif | |
| 64 | |
| 65 using std::min; | 61 using std::min; |
| 66 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; | 62 using NetworkHandle = net::NetworkChangeNotifier::NetworkHandle; |
| 67 | 63 |
| 68 namespace net { | 64 namespace net { |
| 69 | 65 |
| 70 namespace { | 66 namespace { |
| 71 | 67 |
| 72 enum CreateSessionFailure { | 68 enum CreateSessionFailure { |
| 73 CREATION_ERROR_CONNECTING_SOCKET, | 69 CREATION_ERROR_CONNECTING_SOCKET, |
| 74 CREATION_ERROR_SETTING_RECEIVE_BUFFER, | 70 CREATION_ERROR_SETTING_RECEIVE_BUFFER, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 97 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { | 93 void HistogramCreateSessionFailure(enum CreateSessionFailure error) { |
| 98 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, | 94 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.CreationError", error, |
| 99 CREATION_ERROR_MAX); | 95 CREATION_ERROR_MAX); |
| 100 } | 96 } |
| 101 | 97 |
| 102 void HistogramMigrationStatus(enum QuicConnectionMigrationStatus status) { | 98 void HistogramMigrationStatus(enum QuicConnectionMigrationStatus status) { |
| 103 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status, | 99 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionMigration", status, |
| 104 MIGRATION_STATUS_MAX); | 100 MIGRATION_STATUS_MAX); |
| 105 } | 101 } |
| 106 | 102 |
| 107 bool IsEcdsaSupported() { | |
| 108 #if defined(OS_WIN) | |
| 109 if (base::win::GetVersion() < base::win::VERSION_VISTA) | |
| 110 return false; | |
| 111 #endif | |
| 112 | |
| 113 return true; | |
| 114 } | |
| 115 | |
| 116 QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options, | 103 QuicConfig InitializeQuicConfig(const QuicTagVector& connection_options, |
| 117 int idle_connection_timeout_seconds) { | 104 int idle_connection_timeout_seconds) { |
| 118 DCHECK_GT(idle_connection_timeout_seconds, 0); | 105 DCHECK_GT(idle_connection_timeout_seconds, 0); |
| 119 QuicConfig config; | 106 QuicConfig config; |
| 120 config.SetIdleConnectionStateLifetime( | 107 config.SetIdleConnectionStateLifetime( |
| 121 QuicTime::Delta::FromSeconds(idle_connection_timeout_seconds), | 108 QuicTime::Delta::FromSeconds(idle_connection_timeout_seconds), |
| 122 QuicTime::Delta::FromSeconds(idle_connection_timeout_seconds)); | 109 QuicTime::Delta::FromSeconds(idle_connection_timeout_seconds)); |
| 123 config.SetConnectionOptionsToSend(connection_options); | 110 config.SetConnectionOptionsToSend(connection_options); |
| 124 return config; | 111 return config; |
| 125 } | 112 } |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 new ChannelIDSourceChromium(channel_id_service)); | 656 new ChannelIDSourceChromium(channel_id_service)); |
| 670 } | 657 } |
| 671 if (enable_token_binding && channel_id_service) | 658 if (enable_token_binding && channel_id_service) |
| 672 crypto_config_.tb_key_params.push_back(kP256); | 659 crypto_config_.tb_key_params.push_back(kP256); |
| 673 crypto::EnsureOpenSSLInit(); | 660 crypto::EnsureOpenSSLInit(); |
| 674 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); | 661 bool has_aes_hardware_support = !!EVP_has_aes_hardware(); |
| 675 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", | 662 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.PreferAesGcm", |
| 676 has_aes_hardware_support); | 663 has_aes_hardware_support); |
| 677 if (has_aes_hardware_support || prefer_aes_) | 664 if (has_aes_hardware_support || prefer_aes_) |
| 678 crypto_config_.PreferAesGcm(); | 665 crypto_config_.PreferAesGcm(); |
| 679 if (!IsEcdsaSupported()) | |
| 680 crypto_config_.DisableEcdsa(); | |
| 681 // When disk cache is used to store the server configs, HttpCache code calls | 666 // When disk cache is used to store the server configs, HttpCache code calls |
| 682 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't | 667 // |set_quic_server_info_factory| if |quic_server_info_factory_| wasn't |
| 683 // created. | 668 // created. |
| 684 if (max_server_configs_stored_in_properties > 0) { | 669 if (max_server_configs_stored_in_properties > 0) { |
| 685 quic_server_info_factory_.reset( | 670 quic_server_info_factory_.reset( |
| 686 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); | 671 new PropertiesBasedQuicServerInfoFactory(http_server_properties_)); |
| 687 } | 672 } |
| 688 | 673 |
| 689 // migrate_sessions_early should only be set to true if | 674 // migrate_sessions_early should only be set to true if |
| 690 // migrate_sessions_on_network_change is set to true. | 675 // migrate_sessions_on_network_change is set to true. |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 // Since the session was active, there's no longer an | 1781 // Since the session was active, there's no longer an |
| 1797 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1782 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
| 1798 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1783 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
| 1799 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1784 // it as recently broken, which means that 0-RTT will be disabled but we'll |
| 1800 // still race. | 1785 // still race. |
| 1801 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1786 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| 1802 alternative_service); | 1787 alternative_service); |
| 1803 } | 1788 } |
| 1804 | 1789 |
| 1805 } // namespace net | 1790 } // namespace net |
| OLD | NEW |