[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Ryan Hamilton | a3ee93a7 | 2018-08-01 22:03:08 | [diff] [blame] | 5 | #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ |
| 6 | #define NET_QUIC_QUIC_STREAM_FACTORY_H_ |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 7 | |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
[email protected] | 1cd2a5f | 2014-03-14 06:33:25 | [diff] [blame] | 11 | #include <list> |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 12 | #include <map> |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 13 | #include <memory> |
bnc | 614a92d3 | 2016-04-04 13:56:07 | [diff] [blame] | 14 | #include <set> |
[email protected] | 41d6b17 | 2013-01-29 16:10:57 | [diff] [blame] | 15 | #include <string> |
[email protected] | 6e12d70 | 2013-11-13 00:17:17 | [diff] [blame] | 16 | #include <vector> |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 17 | |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 18 | #include "base/containers/mru_cache.h" |
thestig | a0e18cd | 2015-09-25 04:58:36 | [diff] [blame] | 19 | #include "base/gtest_prod_util.h" |
[email protected] | e8cf7555b | 2014-02-28 23:52:53 | [diff] [blame] | 20 | #include "base/logging.h" |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 21 | #include "base/macros.h" |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 22 | #include "base/memory/weak_ptr.h" |
Zhongyi Shi | c16b410 | 2019-02-12 00:37:40 | [diff] [blame] | 23 | #include "base/time/tick_clock.h" |
rtenneti | 8332ba5 | 2015-09-17 19:33:41 | [diff] [blame] | 24 | #include "base/time/time.h" |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 25 | #include "net/base/address_list.h" |
Bence Béky | d8a21fc3 | 2018-06-27 18:29:58 | [diff] [blame] | 26 | #include "net/base/completion_once_callback.h" |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 27 | #include "net/base/host_port_pair.h" |
bnc | 81c46c1f | 2016-10-04 16:25:59 | [diff] [blame] | 28 | #include "net/base/net_export.h" |
[email protected] | f698a01 | 2013-05-06 20:18:59 | [diff] [blame] | 29 | #include "net/base/network_change_notifier.h" |
Lily Houghton | 582d462 | 2018-01-22 22:43:40 | [diff] [blame] | 30 | #include "net/base/proxy_server.h" |
[email protected] | d7d1e50b | 2013-11-25 22:08:09 | [diff] [blame] | 31 | #include "net/cert/cert_database.h" |
zhongyi | 32569c6 | 2016-01-08 02:54:30 | [diff] [blame] | 32 | #include "net/http/http_server_properties.h" |
xunjieli | 2608f9b | 2016-03-14 13:39:23 | [diff] [blame] | 33 | #include "net/http/http_stream_factory.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 34 | #include "net/log/net_log_with_source.h" |
Ryan Hamilton | a3ee93a7 | 2018-08-01 22:03:08 | [diff] [blame] | 35 | #include "net/quic/network_connection.h" |
| 36 | #include "net/quic/quic_chromium_client_session.h" |
| 37 | #include "net/quic/quic_clock_skew_detector.h" |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 38 | #include "net/quic/quic_crypto_client_config_handle.h" |
Ryan Hamilton | a3ee93a7 | 2018-08-01 22:03:08 | [diff] [blame] | 39 | #include "net/quic/quic_session_key.h" |
Yixin Wang | 7f3cdc3f | 2017-11-10 01:44:14 | [diff] [blame] | 40 | #include "net/socket/client_socket_pool.h" |
rch | 02d8779 | 2015-09-09 09:05:53 | [diff] [blame] | 41 | #include "net/ssl/ssl_config_service.h" |
Victor Vasiliev | 6bb59d2 | 2019-03-08 21:34:51 | [diff] [blame] | 42 | #include "net/third_party/quiche/src/quic/core/http/quic_client_push_promise_index.h" |
| 43 | #include "net/third_party/quiche/src/quic/core/quic_config.h" |
| 44 | #include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h" |
| 45 | #include "net/third_party/quiche/src/quic/core/quic_packets.h" |
| 46 | #include "net/third_party/quiche/src/quic/core/quic_server_id.h" |
| 47 | #include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h" |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 48 | |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 49 | namespace base { |
| 50 | class Value; |
xunjieli | 69720dd | 2017-01-30 15:36:29 | [diff] [blame] | 51 | namespace trace_event { |
| 52 | class ProcessMemoryDump; |
| 53 | } |
Ryan Hamilton | a3ee93a7 | 2018-08-01 22:03:08 | [diff] [blame] | 54 | } // namespace base |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 55 | |
Ryan Hamilton | 9835e66 | 2018-08-02 05:36:27 | [diff] [blame] | 56 | namespace quic { |
| 57 | class QuicAlarmFactory; |
| 58 | class QuicClock; |
| 59 | class QuicRandom; |
| 60 | } // namespace quic |
| 61 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 62 | namespace net { |
| 63 | |
estark | 6f9b3d8 | 2016-01-12 21:37:05 | [diff] [blame] | 64 | class CTPolicyEnforcer; |
[email protected] | 6d1b4ed | 2013-07-10 03:57:54 | [diff] [blame] | 65 | class CertVerifier; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 66 | class ClientSocketFactory; |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 67 | class CTVerifier; |
[email protected] | 6d1b4ed | 2013-07-10 03:57:54 | [diff] [blame] | 68 | class HostResolver; |
[email protected] | 77c6c16 | 2013-08-17 02:57:45 | [diff] [blame] | 69 | class HttpServerProperties; |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 70 | class NetLog; |
Matt Menke | 26e4154 | 2019-06-05 01:09:51 | [diff] [blame] | 71 | class NetworkIsolationKey; |
rch | 12fef55 | 2016-01-15 16:26:31 | [diff] [blame] | 72 | class QuicChromiumConnectionHelper; |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 73 | class QuicCryptoClientStreamFactory; |
rtenneti | 13c9d38d | 2015-10-12 21:25:01 | [diff] [blame] | 74 | class QuicServerInfo; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 75 | class QuicStreamFactory; |
Victor Vasiliev | 7752898d | 2019-11-14 21:30:22 | [diff] [blame^] | 76 | class QuicContext; |
tbansal | fdf5665b | 2015-09-21 22:46:40 | [diff] [blame] | 77 | class SocketPerformanceWatcherFactory; |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 78 | class SocketTag; |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 79 | class TransportSecurityState; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 80 | |
[email protected] | c49ff18 | 2013-09-28 08:33:26 | [diff] [blame] | 81 | namespace test { |
| 82 | class QuicStreamFactoryPeer; |
| 83 | } // namespace test |
| 84 | |
rtenneti | 41c0999 | 2015-11-30 18:24:01 | [diff] [blame] | 85 | // When a connection is idle for 30 seconds it will be closed. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 86 | constexpr base::TimeDelta kIdleConnectionTimeout = |
| 87 | base::TimeDelta::FromSeconds(30); |
rtenneti | 41c0999 | 2015-11-30 18:24:01 | [diff] [blame] | 88 | |
Zhongyi Shi | c16b410 | 2019-02-12 00:37:40 | [diff] [blame] | 89 | // Sessions can migrate if they have been idle for less than this period. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 90 | constexpr base::TimeDelta kDefaultIdleSessionMigrationPeriod = |
| 91 | base::TimeDelta::FromSeconds(30); |
Zhongyi Shi | c16b410 | 2019-02-12 00:37:40 | [diff] [blame] | 92 | |
Zhongyi Shi | 99d0cdd | 2019-05-21 01:18:42 | [diff] [blame] | 93 | // The default maximum time allowed to have no retransmittable packets on the |
| 94 | // wire (after sending the first retransmittable packet) if |
Zhongyi Shi | e01f2db | 2019-02-22 19:53:23 | [diff] [blame] | 95 | // |migrate_session_early_v2_| is true. PING frames will be sent as needed to |
| 96 | // enforce this. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 97 | constexpr base::TimeDelta kDefaultRetransmittableOnWireTimeout = |
Zhongyi Shi | 1d96b87 | 2019-10-15 21:49:07 | [diff] [blame] | 98 | base::TimeDelta::FromMilliseconds(200); |
Zhongyi Shi | e01f2db | 2019-02-22 19:53:23 | [diff] [blame] | 99 | |
Zhongyi Shi | 0e52ce7 | 2018-03-20 22:31:00 | [diff] [blame] | 100 | // The default maximum time QUIC session could be on non-default network before |
| 101 | // migrate back to default network. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 102 | constexpr base::TimeDelta kMaxTimeOnNonDefaultNetwork = |
| 103 | base::TimeDelta::FromSeconds(128); |
Zhongyi Shi | 0e52ce7 | 2018-03-20 22:31:00 | [diff] [blame] | 104 | |
Zhongyi Shi | ee76076 | 2018-08-01 00:54:29 | [diff] [blame] | 105 | // The default maximum number of migrations to non default network on write |
| 106 | // error per network. |
| 107 | const int64_t kMaxMigrationsToNonDefaultNetworkOnWriteError = 5; |
| 108 | |
Zhongyi Shi | 0e52ce7 | 2018-03-20 22:31:00 | [diff] [blame] | 109 | // The default maximum number of migrations to non default network on path |
Zhongyi Shi | ee76076 | 2018-08-01 00:54:29 | [diff] [blame] | 110 | // degrading per network. |
Zhongyi Shi | 0e52ce7 | 2018-03-20 22:31:00 | [diff] [blame] | 111 | const int64_t kMaxMigrationsToNonDefaultNetworkOnPathDegrading = 5; |
| 112 | |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 113 | // Maximum number of not currently in use QuicCryptoClientConfig that can be |
| 114 | // stored in |recent_crypto_config_map_|. |
| 115 | // |
| 116 | // TODO(mmenke): Should figure out a reasonable value of this, using field |
| 117 | // trials. The optimal value may increase over time, as QUIC becomes more |
| 118 | // prevalent. Whether or not NetworkIsolationKeys end up including subframe URLs |
| 119 | // will also influence the ideal value. |
| 120 | const int kMaxRecentCryptoConfigs = 100; |
| 121 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 122 | // Structure containing simple configuration options and experiments for QUIC. |
| 123 | struct NET_EXPORT QuicParams { |
| 124 | QuicParams(); |
| 125 | QuicParams(const QuicParams& other); |
| 126 | ~QuicParams(); |
| 127 | |
| 128 | // QUIC runtime configuration options. |
| 129 | |
| 130 | // Versions of QUIC which may be used. |
| 131 | quic::ParsedQuicVersionVector supported_versions; |
| 132 | // User agent description to send in the QUIC handshake. |
| 133 | std::string user_agent_id; |
| 134 | // Limit on the size of QUIC packets. |
| 135 | size_t max_packet_length; |
| 136 | // Maximum number of server configs that are to be stored in |
| 137 | // HttpServerProperties, instead of the disk cache. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 138 | size_t max_server_configs_stored_in_properties = 0u; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 139 | // QUIC will be used for all connections in this set. |
| 140 | std::set<HostPortPair> origins_to_force_quic_on; |
| 141 | // Set of QUIC tags to send in the handshake's connection options. |
| 142 | quic::QuicTagVector connection_options; |
| 143 | // Set of QUIC tags to send in the handshake's connection options that only |
| 144 | // affect the client. |
| 145 | quic::QuicTagVector client_connection_options; |
| 146 | // Enables experimental optimization for receiving data in UDPSocket. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 147 | bool enable_socket_recv_optimization = false; |
Bence Béky | 1ceba55 | 2019-07-19 17:11:05 | [diff] [blame] | 148 | // Initial value of QuicSpdyClientSessionBase::max_allowed_push_id_. |
| 149 | quic::QuicStreamId max_allowed_push_id = 0; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 150 | |
| 151 | // Active QUIC experiments |
| 152 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 153 | // Retry requests which fail with QUIC_PROTOCOL_ERROR, and mark QUIC |
| 154 | // broken if the retry succeeds. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 155 | bool retry_without_alt_svc_on_quic_errors = true; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 156 | // If true, all QUIC sessions are closed when any local IP address changes. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 157 | bool close_sessions_on_ip_change = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 158 | // If true, all QUIC sessions are marked as goaway when any local IP address |
| 159 | // changes. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 160 | bool goaway_sessions_on_ip_change = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 161 | // Specifies QUIC idle connection state lifetime. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 162 | base::TimeDelta idle_connection_timeout = kIdleConnectionTimeout; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 163 | // Specifies the reduced ping timeout subsequent connections should use when |
| 164 | // a connection was timed out with open streams. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 165 | base::TimeDelta reduced_ping_timeout; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 166 | // Maximum time that a session can have no retransmittable packets on the |
| 167 | // wire. Set to zero if not specified and no retransmittable PING will be |
| 168 | // sent to peer when the wire has no retransmittable packets. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 169 | base::TimeDelta retransmittable_on_wire_timeout; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 170 | // Maximum time the session can be alive before crypto handshake is |
| 171 | // finished. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 172 | base::TimeDelta max_time_before_crypto_handshake; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 173 | // Maximum idle time before the crypto handshake has completed. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 174 | base::TimeDelta max_idle_time_before_crypto_handshake; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 175 | // If true, connection migration v2 will be used to migrate existing |
| 176 | // sessions to network when the platform indicates that the default network |
| 177 | // is changing. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 178 | bool migrate_sessions_on_network_change_v2 = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 179 | // If true, connection migration v2 may be used to migrate active QUIC |
| 180 | // sessions to alternative network if current network connectivity is poor. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 181 | bool migrate_sessions_early_v2 = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 182 | // If true, a new connection may be kicked off on an alternate network when |
| 183 | // a connection fails on the default network before handshake is confirmed. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 184 | bool retry_on_alternate_network_before_handshake = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 185 | // If true, an idle session will be migrated within the idle migration |
| 186 | // period. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 187 | bool migrate_idle_sessions = false; |
Zhongyi Shi | af38c4e4 | 2019-08-29 22:49:05 | [diff] [blame] | 188 | // If true, sessions with open streams will attempt to migrate to a different |
| 189 | // port when the current path is poor. |
| 190 | bool allow_port_migration = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 191 | // A session can be migrated if its idle time is within this period. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 192 | base::TimeDelta idle_session_migration_period = |
| 193 | kDefaultIdleSessionMigrationPeriod; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 194 | // Maximum time the session could be on the non-default network before |
| 195 | // migrates back to default network. Defaults to |
| 196 | // kMaxTimeOnNonDefaultNetwork. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 197 | base::TimeDelta max_time_on_non_default_network = kMaxTimeOnNonDefaultNetwork; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 198 | // Maximum number of migrations to the non-default network on write error |
| 199 | // per network for each session. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 200 | int max_migrations_to_non_default_network_on_write_error = |
| 201 | kMaxMigrationsToNonDefaultNetworkOnWriteError; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 202 | // Maximum number of migrations to the non-default network on path |
| 203 | // degrading per network for each session. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 204 | int max_migrations_to_non_default_network_on_path_degrading = |
| 205 | kMaxMigrationsToNonDefaultNetworkOnPathDegrading; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 206 | // If true, allows migration of QUIC connections to a server-specified |
| 207 | // alternate server address. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 208 | bool allow_server_migration = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 209 | // If true, allows QUIC to use alternative services with a different |
| 210 | // hostname from the origin. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 211 | bool allow_remote_alt_svc = true; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 212 | // If true, the quic stream factory may race connection from stale dns |
| 213 | // result with the original dns resolution |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 214 | bool race_stale_dns_on_connection = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 215 | // If true, the quic session may mark itself as GOAWAY on path degrading. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 216 | bool go_away_on_path_degrading = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 217 | // If true, bidirectional streams over QUIC will be disabled. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 218 | bool disable_bidirectional_streams = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 219 | // If true, race cert verification with host resolution. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 220 | bool race_cert_verification = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 221 | // If true, estimate the initial RTT for QUIC connections based on network. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 222 | bool estimate_initial_rtt = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 223 | // If true, client headers will include HTTP/2 stream dependency info |
| 224 | // derived from the request priority. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 225 | bool headers_include_h2_stream_dependency = false; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 226 | // The initial rtt that will be used in crypto handshake if no cached |
| 227 | // smoothed rtt is present. |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 228 | base::TimeDelta initial_rtt_for_handshake; |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 229 | }; |
| 230 | |
Zhongyi Shi | b4737c6 | 2017-09-28 00:49:31 | [diff] [blame] | 231 | enum QuicPlatformNotification { |
| 232 | NETWORK_CONNECTED, |
| 233 | NETWORK_MADE_DEFAULT, |
| 234 | NETWORK_DISCONNECTED, |
| 235 | NETWORK_SOON_TO_DISCONNECT, |
| 236 | NETWORK_IP_ADDRESS_CHANGED, |
| 237 | NETWORK_NOTIFICATION_MAX |
| 238 | }; |
| 239 | |
Yixin Wang | 7891a39d | 2017-11-08 20:59:24 | [diff] [blame] | 240 | // Encapsulates a pending request for a QuicChromiumClientSession. |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 241 | // If the request is still pending when it is destroyed, it will |
| 242 | // cancel the request with the factory. |
| 243 | class NET_EXPORT_PRIVATE QuicStreamRequest { |
| 244 | public: |
zhongyi | 98d6a926 | 2017-05-19 02:47:45 | [diff] [blame] | 245 | explicit QuicStreamRequest(QuicStreamFactory* factory); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 246 | ~QuicStreamRequest(); |
| 247 | |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 248 | // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is |
| 249 | // passed to CertVerifier::Verify. |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 250 | // |destination| will be resolved and resulting IPEndPoint used to open a |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 251 | // quic::QuicConnection. This can be different than |
| 252 | // HostPortPair::FromURL(url). |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 253 | int Request(const HostPortPair& destination, |
Ryan Hamilton | 9ef8c10 | 2019-06-28 03:58:52 | [diff] [blame] | 254 | quic::ParsedQuicVersion quic_version, |
[email protected] | 9dd3ff0f | 2014-03-26 09:51:28 | [diff] [blame] | 255 | PrivacyMode privacy_mode, |
Yixin Wang | 247ea64 | 2017-11-15 01:15:50 | [diff] [blame] | 256 | RequestPriority priority, |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 257 | const SocketTag& socket_tag, |
Matt Menke | 26e4154 | 2019-06-05 01:09:51 | [diff] [blame] | 258 | const NetworkIsolationKey& network_isolation_key, |
dalyk | a9286397 | 2019-10-14 20:25:58 | [diff] [blame] | 259 | bool disable_secure_dns, |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 260 | int cert_verify_flags, |
ckrasic | 3865ee0f | 2016-02-29 22:04:56 | [diff] [blame] | 261 | const GURL& url, |
tfarina | 4283411 | 2016-09-22 13:38:20 | [diff] [blame] | 262 | const NetLogWithSource& net_log, |
Ryan Hamilton | 75f19726 | 2017-08-17 14:00:07 | [diff] [blame] | 263 | NetErrorDetails* net_error_details, |
Zhongyi Shi | a6b68d11 | 2018-09-24 07:49:03 | [diff] [blame] | 264 | CompletionOnceCallback failed_on_default_network_callback, |
Bence Béky | d8a21fc3 | 2018-06-27 18:29:58 | [diff] [blame] | 265 | CompletionOnceCallback callback); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 266 | |
Yixin Wang | 7c5d11a8 | 2017-12-21 02:40:00 | [diff] [blame] | 267 | // This function must be called after Request() returns ERR_IO_PENDING. |
| 268 | // Returns true if Request() requires host resolution and it hasn't completed |
| 269 | // yet. If true is returned, |callback| will run when host resolution |
| 270 | // completes. It will be called with the result after host resolution during |
| 271 | // the connection process. For example, if host resolution returns OK and then |
| 272 | // crypto handshake returns ERR_IO_PENDING, then |callback| will run with |
| 273 | // ERR_IO_PENDING. |
Bence Béky | d8a21fc3 | 2018-06-27 18:29:58 | [diff] [blame] | 274 | bool WaitForHostResolution(CompletionOnceCallback callback); |
Yixin Wang | 7c5d11a8 | 2017-12-21 02:40:00 | [diff] [blame] | 275 | |
| 276 | // Tells QuicStreamRequest it should expect OnHostResolutionComplete() |
| 277 | // to be called in the future. |
| 278 | void ExpectOnHostResolution(); |
| 279 | |
| 280 | // Will be called by the associated QuicStreamFactory::Job when host |
| 281 | // resolution completes asynchronously after Request(). |
| 282 | void OnHostResolutionComplete(int rv); |
| 283 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 284 | void OnRequestComplete(int rv); |
| 285 | |
Zhongyi Shi | a6b68d11 | 2018-09-24 07:49:03 | [diff] [blame] | 286 | // Called when the original connection created on the default network for |
| 287 | // |this| fails and a new connection has been created on the alternate |
| 288 | // network. |
| 289 | void OnConnectionFailedOnDefaultNetwork(); |
| 290 | |
rtenneti | 8332ba5 | 2015-09-17 19:33:41 | [diff] [blame] | 291 | // Helper method that calls |factory_|'s GetTimeDelayForWaitingJob(). It |
| 292 | // returns the amount of time waiting job should be delayed. |
| 293 | base::TimeDelta GetTimeDelayForWaitingJob() const; |
| 294 | |
Lily Chen | f11e129 | 2018-11-29 16:42:09 | [diff] [blame] | 295 | // If host resolution is underway, changes the priority of the host resolver |
| 296 | // request. |
| 297 | void SetPriority(RequestPriority priority); |
| 298 | |
Yixin Wang | 7891a39d | 2017-11-08 20:59:24 | [diff] [blame] | 299 | // Releases the handle to the QUIC session retrieved as a result of Request(). |
| 300 | std::unique_ptr<QuicChromiumClientSession::Handle> ReleaseSessionHandle(); |
xunjieli | 2608f9b | 2016-03-14 13:39:23 | [diff] [blame] | 301 | |
| 302 | // Sets |session_|. |
rch | f0b18c8a | 2017-05-05 19:31:57 | [diff] [blame] | 303 | void SetSession(std::unique_ptr<QuicChromiumClientSession::Handle> session); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 304 | |
Ryan Hamilton | 75f19726 | 2017-08-17 14:00:07 | [diff] [blame] | 305 | NetErrorDetails* net_error_details() { return net_error_details_; } |
| 306 | |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 307 | const QuicSessionKey& session_key() const { return session_key_; } |
bnc | cb7ff3c | 2015-05-21 20:51:55 | [diff] [blame] | 308 | |
tfarina | 4283411 | 2016-09-22 13:38:20 | [diff] [blame] | 309 | const NetLogWithSource& net_log() const { return net_log_; } |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 310 | |
| 311 | private: |
| 312 | QuicStreamFactory* factory_; |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 313 | QuicSessionKey session_key_; |
tfarina | 4283411 | 2016-09-22 13:38:20 | [diff] [blame] | 314 | NetLogWithSource net_log_; |
Bence Béky | d8a21fc3 | 2018-06-27 18:29:58 | [diff] [blame] | 315 | CompletionOnceCallback callback_; |
Zhongyi Shi | a6b68d11 | 2018-09-24 07:49:03 | [diff] [blame] | 316 | CompletionOnceCallback failed_on_default_network_callback_; |
Ryan Hamilton | 75f19726 | 2017-08-17 14:00:07 | [diff] [blame] | 317 | NetErrorDetails* net_error_details_; // Unowned. |
rch | f0b18c8a | 2017-05-05 19:31:57 | [diff] [blame] | 318 | std::unique_ptr<QuicChromiumClientSession::Handle> session_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 319 | |
Yixin Wang | 7c5d11a8 | 2017-12-21 02:40:00 | [diff] [blame] | 320 | // Set in Request(). If true, then OnHostResolutionComplete() is expected to |
| 321 | // be called in the future. |
| 322 | bool expect_on_host_resolution_; |
| 323 | // Callback passed to WaitForHostResolution(). |
Bence Béky | d8a21fc3 | 2018-06-27 18:29:58 | [diff] [blame] | 324 | CompletionOnceCallback host_resolution_callback_; |
Yixin Wang | 7c5d11a8 | 2017-12-21 02:40:00 | [diff] [blame] | 325 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 326 | DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest); |
| 327 | }; |
| 328 | |
Yixin Wang | 7891a39d | 2017-11-08 20:59:24 | [diff] [blame] | 329 | // A factory for fetching QuicChromiumClientSessions. |
[email protected] | f698a01 | 2013-05-06 20:18:59 | [diff] [blame] | 330 | class NET_EXPORT_PRIVATE QuicStreamFactory |
[email protected] | d7d1e50b | 2013-11-25 22:08:09 | [diff] [blame] | 331 | : public NetworkChangeNotifier::IPAddressObserver, |
jri | 7e63664 | 2016-01-14 06:57:08 | [diff] [blame] | 332 | public NetworkChangeNotifier::NetworkObserver, |
[email protected] | d7d1e50b | 2013-11-25 22:08:09 | [diff] [blame] | 333 | public CertDatabase::Observer { |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 334 | public: |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 335 | // This class encompasses |destination| and |server_id|. |
| 336 | // |destination| is a HostPortPair which is resolved |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 337 | // and a quic::QuicConnection is made to the resulting IP address. |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 338 | // |server_id| identifies the origin of the request, |
| 339 | // the crypto handshake advertises |server_id.host()| to the server, |
| 340 | // and the certificate is also matched against |server_id.host()|. |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 341 | class NET_EXPORT_PRIVATE QuicSessionAliasKey { |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 342 | public: |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 343 | QuicSessionAliasKey() = default; |
| 344 | QuicSessionAliasKey(const HostPortPair& destination, |
| 345 | const QuicSessionKey& session_key); |
| 346 | ~QuicSessionAliasKey() = default; |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 347 | |
| 348 | // Needed to be an element of std::set. |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 349 | bool operator<(const QuicSessionAliasKey& other) const; |
| 350 | bool operator==(const QuicSessionAliasKey& other) const; |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 351 | |
| 352 | const HostPortPair& destination() const { return destination_; } |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 353 | const quic::QuicServerId& server_id() const { |
| 354 | return session_key_.server_id(); |
| 355 | } |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 356 | const QuicSessionKey& session_key() const { return session_key_; } |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 357 | |
xunjieli | 69720dd | 2017-01-30 15:36:29 | [diff] [blame] | 358 | // Returns the estimate of dynamically allocated memory in bytes. |
| 359 | size_t EstimateMemoryUsage() const; |
| 360 | |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 361 | private: |
| 362 | HostPortPair destination_; |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 363 | QuicSessionKey session_key_; |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 364 | }; |
| 365 | |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 366 | QuicStreamFactory( |
jri | df673d2 | 2016-06-02 22:06:33 | [diff] [blame] | 367 | NetLog* net_log, |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 368 | HostResolver* host_resolver, |
nharper | 642ae4b | 2016-06-30 00:40:36 | [diff] [blame] | 369 | SSLConfigService* ssl_config_service, |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 370 | ClientSocketFactory* client_socket_factory, |
bnc | 525e175a | 2016-06-20 12:36:40 | [diff] [blame] | 371 | HttpServerProperties* http_server_properties, |
[email protected] | 59c0bbd | 2014-03-22 04:08:12 | [diff] [blame] | 372 | CertVerifier* cert_verifier, |
estark | 6f9b3d8 | 2016-01-12 21:37:05 | [diff] [blame] | 373 | CTPolicyEnforcer* ct_policy_enforcer, |
[email protected] | 080b7793 | 2014-08-04 01:22:46 | [diff] [blame] | 374 | TransportSecurityState* transport_security_state, |
rtenneti | 052774e | 2015-11-24 21:00:12 | [diff] [blame] | 375 | CTVerifier* cert_transparency_verifier, |
tbansal | c8a94ea | 2015-11-02 23:58:51 | [diff] [blame] | 376 | SocketPerformanceWatcherFactory* socket_performance_watcher_factory, |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 377 | QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
Victor Vasiliev | 7752898d | 2019-11-14 21:30:22 | [diff] [blame^] | 378 | QuicContext* context, |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 379 | const QuicParams& params); |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 380 | ~QuicStreamFactory() override; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 381 | |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 382 | // Returns true if there is an existing session for |session_key| or if the |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 383 | // request can be pooled to an existing session to the IP address of |
| 384 | // |destination|. |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 385 | bool CanUseExistingSession(const QuicSessionKey& session_key, |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 386 | const HostPortPair& destination); |
zhongyi | 32569c6 | 2016-01-08 02:54:30 | [diff] [blame] | 387 | |
Yixin Wang | 7891a39d | 2017-11-08 20:59:24 | [diff] [blame] | 388 | // Fetches a QuicChromiumClientSession to |host_port_pair| which will be |
rch | f114d98 | 2015-10-21 01:34:56 | [diff] [blame] | 389 | // owned by |request|. |
[email protected] | 0cceb92 | 2014-07-01 02:00:56 | [diff] [blame] | 390 | // If a matching session already exists, this method will return OK. If no |
| 391 | // matching session exists, this will return ERR_IO_PENDING and will invoke |
| 392 | // OnRequestComplete asynchronously. |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 393 | int Create(const QuicSessionKey& session_key, |
bnc | 359ed2a | 2016-04-29 20:43:45 | [diff] [blame] | 394 | const HostPortPair& destination, |
Ryan Hamilton | 9ef8c10 | 2019-06-28 03:58:52 | [diff] [blame] | 395 | quic::ParsedQuicVersion quic_version, |
Yixin Wang | 247ea64 | 2017-11-15 01:15:50 | [diff] [blame] | 396 | RequestPriority priority, |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 397 | int cert_verify_flags, |
ckrasic | 3865ee0f | 2016-02-29 22:04:56 | [diff] [blame] | 398 | const GURL& url, |
tfarina | 4283411 | 2016-09-22 13:38:20 | [diff] [blame] | 399 | const NetLogWithSource& net_log, |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 400 | QuicStreamRequest* request); |
| 401 | |
[email protected] | 4d283b3 | 2013-10-17 12:57:27 | [diff] [blame] | 402 | // Called by a session when it is going away and no more streams should be |
| 403 | // created on it. |
ckrasic | 4f9d88d | 2015-07-22 22:23:16 | [diff] [blame] | 404 | void OnSessionGoingAway(QuicChromiumClientSession* session); |
[email protected] | 4d283b3 | 2013-10-17 12:57:27 | [diff] [blame] | 405 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 406 | // Called by a session after it shuts down. |
ckrasic | 4f9d88d | 2015-07-22 22:23:16 | [diff] [blame] | 407 | void OnSessionClosed(QuicChromiumClientSession* session); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 408 | |
rch | 9ecde09b | 2017-04-08 00:18:23 | [diff] [blame] | 409 | // Called by a session when it blackholes after the handshake is confirmed. |
| 410 | void OnBlackholeAfterHandshakeConfirmed(QuicChromiumClientSession* session); |
zhongyi | dd1439f6 | 2016-09-02 02:02:26 | [diff] [blame] | 411 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 412 | // Cancels a pending request. |
| 413 | void CancelRequest(QuicStreamRequest* request); |
| 414 | |
Lily Chen | f11e129 | 2018-11-29 16:42:09 | [diff] [blame] | 415 | // Sets priority of a request. |
| 416 | void SetRequestPriority(QuicStreamRequest* request, RequestPriority priority); |
| 417 | |
Renjie | ba55fae | 2018-09-20 03:05:16 | [diff] [blame] | 418 | // Closes all current sessions with specified network, QUIC error codes. |
| 419 | // It sends connection close packet when closing connections. |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 420 | void CloseAllSessions(int error, quic::QuicErrorCode quic_error); |
[email protected] | 56dfb90 | 2013-01-03 23:17:55 | [diff] [blame] | 421 | |
danakj | ad1777e | 2016-04-16 00:56:42 | [diff] [blame] | 422 | std::unique_ptr<base::Value> QuicStreamFactoryInfoToValue() const; |
[email protected] | c5b061b | 2013-01-05 00:31:34 | [diff] [blame] | 423 | |
msramek | 992625ec | 2016-08-04 18:33:58 | [diff] [blame] | 424 | // Delete cached state objects in |crypto_config_|. If |origin_filter| is not |
| 425 | // null, only objects on matching origins will be deleted. |
| 426 | void ClearCachedStatesInCryptoConfig( |
| 427 | const base::Callback<bool(const GURL&)>& origin_filter); |
[email protected] | f7e21a43 | 2014-04-21 22:17:57 | [diff] [blame] | 428 | |
jri | 7e63664 | 2016-01-14 06:57:08 | [diff] [blame] | 429 | // Helper method that configures a DatagramClientSocket. Socket is |
| 430 | // bound to the default network if the |network| param is |
| 431 | // NetworkChangeNotifier::kInvalidNetworkHandle. |
| 432 | // Returns net_error code. |
| 433 | int ConfigureSocket(DatagramClientSocket* socket, |
| 434 | IPEndPoint addr, |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 435 | NetworkChangeNotifier::NetworkHandle network, |
| 436 | const SocketTag& socket_tag); |
jri | 7e63664 | 2016-01-14 06:57:08 | [diff] [blame] | 437 | |
jri | ae8cfdc | 2016-01-21 19:44:35 | [diff] [blame] | 438 | // Finds an alternative to |old_network| from the platform's list of connected |
| 439 | // networks. Returns NetworkChangeNotifier::kInvalidNetworkHandle if no |
| 440 | // alternative is found. |
| 441 | NetworkChangeNotifier::NetworkHandle FindAlternateNetwork( |
| 442 | NetworkChangeNotifier::NetworkHandle old_network); |
| 443 | |
Zhongyi Shi | 673f22ef | 2017-10-18 00:00:47 | [diff] [blame] | 444 | // Creates a datagram socket. |source| is the NetLogSource for the entity |
| 445 | // trying to create the socket, if it has one. |
| 446 | std::unique_ptr<DatagramClientSocket> CreateSocket( |
| 447 | NetLog* net_log, |
| 448 | const NetLogSource& source); |
| 449 | |
[email protected] | f698a01 | 2013-05-06 20:18:59 | [diff] [blame] | 450 | // NetworkChangeNotifier::IPAddressObserver methods: |
| 451 | |
Jana Iyengar | 903dec2 | 2017-11-28 00:44:23 | [diff] [blame] | 452 | // Until the servers support roaming, close all connections when the local |
| 453 | // IP address changes. |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 454 | void OnIPAddressChanged() override; |
[email protected] | f698a01 | 2013-05-06 20:18:59 | [diff] [blame] | 455 | |
jri | 7e63664 | 2016-01-14 06:57:08 | [diff] [blame] | 456 | // NetworkChangeNotifier::NetworkObserver methods: |
| 457 | void OnNetworkConnected( |
| 458 | NetworkChangeNotifier::NetworkHandle network) override; |
| 459 | void OnNetworkDisconnected( |
| 460 | NetworkChangeNotifier::NetworkHandle network) override; |
| 461 | void OnNetworkSoonToDisconnect( |
| 462 | NetworkChangeNotifier::NetworkHandle network) override; |
| 463 | void OnNetworkMadeDefault( |
| 464 | NetworkChangeNotifier::NetworkHandle network) override; |
| 465 | |
[email protected] | d7d1e50b | 2013-11-25 22:08:09 | [diff] [blame] | 466 | // CertDatabase::Observer methods: |
| 467 | |
| 468 | // We close all sessions when certificate database is changed. |
mattm | fd05a1f | 2017-02-18 06:18:44 | [diff] [blame] | 469 | void OnCertDBChanged() override; |
[email protected] | d7d1e50b | 2013-11-25 22:08:09 | [diff] [blame] | 470 | |
Matt Menke | b566c39 | 2019-09-11 23:22:43 | [diff] [blame] | 471 | bool is_quic_known_to_work_on_current_network() const { |
| 472 | return is_quic_known_to_work_on_current_network_; |
| 473 | } |
[email protected] | 11c0587 | 2013-08-20 02:04:12 | [diff] [blame] | 474 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 475 | bool allow_server_migration() const { return params_.allow_server_migration; } |
Zhongyi Shi | f124a58 | 2017-11-02 00:15:04 | [diff] [blame] | 476 | |
Matt Menke | b566c39 | 2019-09-11 23:22:43 | [diff] [blame] | 477 | void set_is_quic_known_to_work_on_current_network( |
| 478 | bool is_quic_known_to_work_on_current_network); |
[email protected] | 11c0587 | 2013-08-20 02:04:12 | [diff] [blame] | 479 | |
rtenneti | 8332ba5 | 2015-09-17 19:33:41 | [diff] [blame] | 480 | // It returns the amount of time waiting job should be delayed. |
Renjie Tang | dd70897 | 2019-10-03 20:56:21 | [diff] [blame] | 481 | base::TimeDelta GetTimeDelayForWaitingJob(const QuicSessionKey& session_key); |
rtenneti | 8332ba5 | 2015-09-17 19:33:41 | [diff] [blame] | 482 | |
rch | 12fef55 | 2016-01-15 16:26:31 | [diff] [blame] | 483 | QuicChromiumConnectionHelper* helper() { return helper_.get(); } |
[email protected] | 2cfc6bb8 | 2013-10-27 03:40:44 | [diff] [blame] | 484 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 485 | quic::QuicAlarmFactory* alarm_factory() { return alarm_factory_.get(); } |
rch | 16c74d1d | 2016-04-22 06:14:07 | [diff] [blame] | 486 | |
zhongyi | af25754 | 2016-12-19 03:36:01 | [diff] [blame] | 487 | void set_server_push_delegate(ServerPushDelegate* push_delegate) { |
| 488 | push_delegate_ = push_delegate; |
| 489 | } |
| 490 | |
Zhongyi Shi | 8de4383 | 2018-08-15 23:40:00 | [diff] [blame] | 491 | NetworkChangeNotifier::NetworkHandle default_network() const { |
| 492 | return default_network_; |
| 493 | } |
| 494 | |
xunjieli | 69720dd | 2017-01-30 15:36:29 | [diff] [blame] | 495 | // Dumps memory allocation stats. |parent_dump_absolute_name| is the name |
| 496 | // used by the parent MemoryAllocatorDump in the memory dump hierarchy. |
| 497 | void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, |
| 498 | const std::string& parent_absolute_name) const; |
| 499 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 500 | private: |
| 501 | class Job; |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 502 | class CertVerifierJob; |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 503 | class QuicCryptoClientConfigOwner; |
| 504 | class CryptoClientConfigHandle; |
[email protected] | c49ff18 | 2013-09-28 08:33:26 | [diff] [blame] | 505 | friend class test::QuicStreamFactoryPeer; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 506 | |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 507 | typedef std::map<QuicSessionKey, QuicChromiumClientSession*> SessionMap; |
| 508 | typedef std::map<QuicChromiumClientSession*, QuicSessionAliasKey> |
| 509 | SessionIdMap; |
| 510 | typedef std::set<QuicSessionAliasKey> AliasSet; |
ckrasic | 4f9d88d | 2015-07-22 22:23:16 | [diff] [blame] | 511 | typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; |
| 512 | typedef std::set<QuicChromiumClientSession*> SessionSet; |
rch | f114d98 | 2015-10-21 01:34:56 | [diff] [blame] | 513 | typedef std::map<IPEndPoint, SessionSet> IPAliasMap; |
jri | 94ddc314 | 2016-08-26 01:32:43 | [diff] [blame] | 514 | typedef std::map<QuicChromiumClientSession*, IPEndPoint> SessionPeerIPMap; |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 515 | typedef std::map<QuicSessionKey, std::unique_ptr<Job>> JobMap; |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 516 | typedef std::map<quic::QuicServerId, std::unique_ptr<CertVerifierJob>> |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 517 | CertVerifierJobMap; |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 518 | using QuicCryptoClientConfigMap = |
| 519 | std::map<NetworkIsolationKey, |
| 520 | std::unique_ptr<QuicCryptoClientConfigOwner>>; |
rtenneti | 14abd31 | 2015-02-06 21:56:01 | [diff] [blame] | 521 | |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 522 | bool HasMatchingIpSession(const QuicSessionAliasKey& key, |
Yixin Wang | 7c5d11a8 | 2017-12-21 02:40:00 | [diff] [blame] | 523 | const AddressList& address_list); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 524 | void OnJobComplete(Job* job, int rv); |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 525 | void OnCertVerifyJobComplete(CertVerifierJob* job, int rv); |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 526 | bool HasActiveSession(const QuicSessionKey& session_key) const; |
| 527 | bool HasActiveJob(const QuicSessionKey& session_key) const; |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 528 | bool HasActiveCertVerifierJob(const quic::QuicServerId& server_id) const; |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 529 | int CreateSession(const QuicSessionAliasKey& key, |
Ryan Hamilton | 9ef8c10 | 2019-06-28 03:58:52 | [diff] [blame] | 530 | quic::ParsedQuicVersion quic_version, |
rtenneti | a75df62 | 2015-06-21 23:59:50 | [diff] [blame] | 531 | int cert_verify_flags, |
rch | 433bf5f | 2017-02-14 04:10:47 | [diff] [blame] | 532 | bool require_confirmation, |
[email protected] | 338e798 | 2013-12-13 11:15:32 | [diff] [blame] | 533 | const AddressList& address_list, |
xunjieli | 100937eb5 | 2016-09-15 20:09:37 | [diff] [blame] | 534 | base::TimeTicks dns_resolution_start_time, |
rtenneti | f4f0885 | 2015-02-27 17:50:04 | [diff] [blame] | 535 | base::TimeTicks dns_resolution_end_time, |
tfarina | 4283411 | 2016-09-22 13:38:20 | [diff] [blame] | 536 | const NetLogWithSource& net_log, |
Zhongyi Shi | 55ec953 | 2018-07-24 03:57:39 | [diff] [blame] | 537 | QuicChromiumClientSession** session, |
| 538 | NetworkChangeNotifier::NetworkHandle* network); |
Paul Jensen | 8e3c5d3 | 2018-02-19 17:06:33 | [diff] [blame] | 539 | void ActivateSession(const QuicSessionAliasKey& key, |
ckrasic | 4f9d88d | 2015-07-22 22:23:16 | [diff] [blame] | 540 | QuicChromiumClientSession* session); |
Charles 'Buck' Krasic | 71763c9f | 2018-02-16 02:37:28 | [diff] [blame] | 541 | void MarkAllActiveSessionsGoingAway(); |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 542 | |
Matt Menke | 19475f7 | 2019-08-21 18:57:44 | [diff] [blame] | 543 | void ConfigureInitialRttEstimate( |
| 544 | const quic::QuicServerId& server_id, |
| 545 | const NetworkIsolationKey& network_isolation_key, |
| 546 | quic::QuicConfig* config); |
rch | d6163f3 | 2017-01-30 23:50:38 | [diff] [blame] | 547 | |
rtenneti | 2912825c | 2015-01-06 01:19:46 | [diff] [blame] | 548 | // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there |
| 549 | // is no |http_server_properties_| or if |http_server_properties_| doesn't |
| 550 | // have ServerNetworkStats for the given |server_id|. |
Avi Drissman | 13fc893 | 2015-12-20 04:40:46 | [diff] [blame] | 551 | int64_t GetServerNetworkStatsSmoothedRttInMicroseconds( |
Matt Menke | 19475f7 | 2019-08-21 18:57:44 | [diff] [blame] | 552 | const quic::QuicServerId& server_id, |
| 553 | const NetworkIsolationKey& network_isolation_key) const; |
rtenneti | 2912825c | 2015-01-06 01:19:46 | [diff] [blame] | 554 | |
rch | d6163f3 | 2017-01-30 23:50:38 | [diff] [blame] | 555 | // Returns |srtt| from ServerNetworkStats. Returns null if there |
| 556 | // is no |http_server_properties_| or if |http_server_properties_| doesn't |
| 557 | // have ServerNetworkStats for the given |server_id|. |
| 558 | const base::TimeDelta* GetServerNetworkStatsSmoothedRtt( |
Matt Menke | 19475f7 | 2019-08-21 18:57:44 | [diff] [blame] | 559 | const quic::QuicServerId& server_id, |
| 560 | const NetworkIsolationKey& network_isolation_key) const; |
rch | d6163f3 | 2017-01-30 23:50:38 | [diff] [blame] | 561 | |
bnc | cacc099 | 2015-03-20 20:22:22 | [diff] [blame] | 562 | // Helper methods. |
Matt Menke | b32ba512 | 2019-09-10 19:17:05 | [diff] [blame] | 563 | bool WasQuicRecentlyBroken(const QuicSessionKey& session_key) const; |
rtenneti | 8332ba5 | 2015-09-17 19:33:41 | [diff] [blame] | 564 | |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 565 | // Starts an asynchronous job for cert verification if |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 566 | // |params_.race_cert_verification| is enabled and if there are cached certs |
| 567 | // for the given |server_id|. |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 568 | // |
| 569 | // Takes a constant reference to a CryptoClientConfigHandle instead of a |
| 570 | // NetworkIsolationKey to force the caller to keep the corresponding |
| 571 | // QuicCryptoClientConfig alive. There's no guarantee it won't be garbage |
| 572 | // collected beyond when this method completes, otherwise. |
| 573 | quic::QuicAsyncStatus StartCertVerifyJob( |
| 574 | const CryptoClientConfigHandle& crypto_config_handle, |
| 575 | const quic::QuicServerId& server_id, |
| 576 | int cert_verify_flags, |
| 577 | const NetLogWithSource& net_log); |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 578 | |
Zhongyi Shi | d04bd41 | 2019-08-26 23:31:08 | [diff] [blame] | 579 | // Helper method to initialize the following migration options and check |
| 580 | // pre-requisites: |
| 581 | // - |params_.migrate_sessions_on_network_change_v2| |
| 582 | // - |params_.migrate_sessions_early_v2| |
| 583 | // - |params_.migrate_idle_sessions| |
| 584 | // - |params_.retry_on_alternate_network_before_handshake| |
| 585 | // If pre-requisites are not met, turn off the corresponding options. |
| 586 | void InitializeMigrationOptions(); |
| 587 | |
[email protected] | 257f24f | 2014-04-01 09:15:37 | [diff] [blame] | 588 | // Initializes the cached state associated with |server_id| in |
rch | f37ccc78 | 2016-01-31 05:13:50 | [diff] [blame] | 589 | // |crypto_config_| with the information in |server_info|. Populates |
| 590 | // |connection_id| with the next server designated connection id, |
| 591 | // if any, and otherwise leaves it unchanged. |
[email protected] | 60cf50e | 2014-04-28 23:23:18 | [diff] [blame] | 592 | void InitializeCachedStateInCryptoConfig( |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 593 | const CryptoClientConfigHandle& crypto_config_handle, |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 594 | const quic::QuicServerId& server_id, |
danakj | ad1777e | 2016-04-16 00:56:42 | [diff] [blame] | 595 | const std::unique_ptr<QuicServerInfo>& server_info, |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 596 | quic::QuicConnectionId* connection_id); |
[email protected] | b694e48c | 2014-03-18 17:10:13 | [diff] [blame] | 597 | |
ckrasic | 4f9d88d | 2015-07-22 22:23:16 | [diff] [blame] | 598 | void ProcessGoingAwaySession(QuicChromiumClientSession* session, |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 599 | const quic::QuicServerId& server_id, |
[email protected] | eb71ab6 | 2014-05-23 07:57:53 | [diff] [blame] | 600 | bool was_session_active); |
[email protected] | 4d590c9c | 2014-05-02 05:14:33 | [diff] [blame] | 601 | |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 602 | // Creates a CreateCryptoConfigHandle for the specified NetworkIsolationKey. |
| 603 | // If there's already a corresponding entry in |active_crypto_config_map_|, |
| 604 | // reuses it. If there's a corresponding entry in |recent_crypto_config_map_|, |
| 605 | // promotes it to |active_crypto_config_map_| and then reuses it. Otherwise, |
| 606 | // creates a new entry in |active_crypto_config_map_|. |
| 607 | std::unique_ptr<CryptoClientConfigHandle> CreateCryptoConfigHandle( |
| 608 | const NetworkIsolationKey& network_isolation_key); |
| 609 | |
| 610 | // Salled when the indicated member of |active_crypto_config_map_| has no |
| 611 | // outstanding references. The QuicCryptoClientConfigOwner is then moved to |
| 612 | // |recent_crypto_config_map_|, an MRU cache. |
| 613 | void OnAllCryptoClientRefReleased( |
| 614 | QuicCryptoClientConfigMap::iterator& map_iterator); |
| 615 | |
| 616 | std::unique_ptr<QuicCryptoClientConfigHandle> GetCryptoConfigForTesting( |
| 617 | const NetworkIsolationKey& network_isolation_key); |
| 618 | |
| 619 | quic::QuicAsyncStatus StartCertVerifyJobForTesting( |
| 620 | const quic::QuicServerId& server_id, |
| 621 | const NetworkIsolationKey& network_isolation_key, |
| 622 | int cert_verify_flags, |
| 623 | const NetLogWithSource& net_log); |
| 624 | |
Matt Menke | ca525331 | 2019-09-23 18:59:37 | [diff] [blame] | 625 | bool CryptoConfigCacheIsEmptyForTesting( |
| 626 | const quic::QuicServerId& server_id, |
| 627 | const NetworkIsolationKey& network_isolation_key); |
| 628 | |
Matt Menke | b566c39 | 2019-09-11 23:22:43 | [diff] [blame] | 629 | // Whether QUIC is known to work on current network. This is true when QUIC is |
| 630 | // expected to work in general, rather than whether QUIC was broken / recently |
| 631 | // broken when used with a particular server. That information is stored in |
| 632 | // the broken alternative service map in HttpServerProperties. |
| 633 | bool is_quic_known_to_work_on_current_network_; |
| 634 | |
jri | df673d2 | 2016-06-02 22:06:33 | [diff] [blame] | 635 | NetLog* net_log_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 636 | HostResolver* host_resolver_; |
| 637 | ClientSocketFactory* client_socket_factory_; |
bnc | 525e175a | 2016-06-20 12:36:40 | [diff] [blame] | 638 | HttpServerProperties* http_server_properties_; |
zhongyi | af25754 | 2016-12-19 03:36:01 | [diff] [blame] | 639 | ServerPushDelegate* push_delegate_; |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 640 | CertVerifier* const cert_verifier_; |
| 641 | CTPolicyEnforcer* const ct_policy_enforcer_; |
| 642 | TransportSecurityState* const transport_security_state_; |
| 643 | CTVerifier* const cert_transparency_verifier_; |
[email protected] | e8ff2684 | 2013-03-22 21:02:05 | [diff] [blame] | 644 | QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 645 | quic::QuicRandom* random_generator_; // Unowned. |
Victor Vasiliev | 7752898d | 2019-11-14 21:30:22 | [diff] [blame^] | 646 | const quic::QuicClock* clock_; // Unowned. |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 647 | QuicParams params_; |
rch | f11cc0f | 2016-11-15 03:04:32 | [diff] [blame] | 648 | QuicClockSkewDetector clock_skew_detector_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 649 | |
tbansal | fdf5665b | 2015-09-21 22:46:40 | [diff] [blame] | 650 | // Factory which is used to create socket performance watcher. A new watcher |
| 651 | // is created for every QUIC connection. |
| 652 | // |socket_performance_watcher_factory_| may be null. |
tbansal | c8a94ea | 2015-11-02 23:58:51 | [diff] [blame] | 653 | SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
tbansal | fdf5665b | 2015-09-21 22:46:40 | [diff] [blame] | 654 | |
[email protected] | 2cfc6bb8 | 2013-10-27 03:40:44 | [diff] [blame] | 655 | // The helper used for all connections. |
danakj | ad1777e | 2016-04-16 00:56:42 | [diff] [blame] | 656 | std::unique_ptr<QuicChromiumConnectionHelper> helper_; |
[email protected] | 2cfc6bb8 | 2013-10-27 03:40:44 | [diff] [blame] | 657 | |
rch | 16c74d1d | 2016-04-22 06:14:07 | [diff] [blame] | 658 | // The alarm factory used for all connections. |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 659 | std::unique_ptr<quic::QuicAlarmFactory> alarm_factory_; |
rch | 16c74d1d | 2016-04-22 06:14:07 | [diff] [blame] | 660 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 661 | // Contains owning pointers to all sessions that currently exist. |
[email protected] | 4d590c9c | 2014-05-02 05:14:33 | [diff] [blame] | 662 | SessionIdMap all_sessions_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 663 | // Contains non-owning pointers to currently active session |
| 664 | // (not going away session, once they're implemented). |
| 665 | SessionMap active_sessions_; |
[email protected] | eed749f9 | 2013-12-23 18:57:38 | [diff] [blame] | 666 | // Map from session to set of aliases that this session is known by. |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 667 | SessionAliasMap session_aliases_; |
[email protected] | eed749f9 | 2013-12-23 18:57:38 | [diff] [blame] | 668 | // Map from IP address to sessions which are connected to this address. |
| 669 | IPAliasMap ip_aliases_; |
jri | 94ddc314 | 2016-08-26 01:32:43 | [diff] [blame] | 670 | // Map from session to its original peer IP address. |
| 671 | SessionPeerIPMap session_peer_ip_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 672 | |
[email protected] | d8e2abf8 | 2014-03-06 10:30:10 | [diff] [blame] | 673 | // Origins which have gone away recently. |
| 674 | AliasSet gone_away_aliases_; |
| 675 | |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 676 | // When a QuicCryptoClientConfig is in use, it has one or more live |
| 677 | // CryptoClientConfigHandles, and is stored in |active_crypto_config_map_|. |
| 678 | // Once all the handles are deleted, it's moved to |
| 679 | // |recent_crypto_config_map_|. If reused before it is evicted from MRUCache, |
| 680 | // it will be removed from the cache and return to the active config map. |
| 681 | // These two maps should never both have entries with the same |
| 682 | // NetworkIsolationKey. |
| 683 | QuicCryptoClientConfigMap active_crypto_config_map_; |
| 684 | base::MRUCache<NetworkIsolationKey, |
| 685 | std::unique_ptr<QuicCryptoClientConfigOwner>> |
| 686 | recent_crypto_config_map_; |
| 687 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 688 | const quic::QuicConfig config_; |
[email protected] | b06431078 | 2013-05-30 21:12:17 | [diff] [blame] | 689 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 690 | JobMap active_jobs_; |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 691 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 692 | // Map of quic::QuicServerId to owning CertVerifierJob. |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 693 | CertVerifierJobMap active_cert_verifier_jobs_; |
| 694 | |
zhongyi | dd1439f6 | 2016-09-02 02:02:26 | [diff] [blame] | 695 | // PING timeout for connections. |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 696 | quic::QuicTime::Delta ping_timeout_; |
| 697 | quic::QuicTime::Delta reduced_ping_timeout_; |
zhongyi | dd1439f6 | 2016-09-02 02:02:26 | [diff] [blame] | 698 | |
Zhongyi Shi | e01f2db | 2019-02-22 19:53:23 | [diff] [blame] | 699 | // Timeout for how long the wire can have no retransmittable packets. |
| 700 | quic::QuicTime::Delta retransmittable_on_wire_timeout_; |
| 701 | |
rtenneti | 1cd3b16 | 2015-09-29 02:58:28 | [diff] [blame] | 702 | // If more than |yield_after_packets_| packets have been read or more than |
| 703 | // |yield_after_duration_| time has passed, then |
rch | a02807b4 | 2016-01-29 21:56:15 | [diff] [blame] | 704 | // QuicChromiumPacketReader::StartReading() yields by doing a PostTask(). |
rtenneti | 1cd3b16 | 2015-09-29 02:58:28 | [diff] [blame] | 705 | int yield_after_packets_; |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 706 | quic::QuicTime::Delta yield_after_duration_; |
rtenneti | 1cd3b16 | 2015-09-29 02:58:28 | [diff] [blame] | 707 | |
Zhongyi Shi | 6db1346 | 2018-05-19 01:36:26 | [diff] [blame] | 708 | // If |migrate_sessions_early_v2_| is true, tracks the current default |
| 709 | // network, and is updated OnNetworkMadeDefault. |
| 710 | // Otherwise, always set to NetworkChangeNotifier::kInvalidNetwork. |
| 711 | NetworkChangeNotifier::NetworkHandle default_network_; |
| 712 | |
rtenneti | fc47e0e | 2014-09-26 02:54:05 | [diff] [blame] | 713 | // Local address of socket that was created in CreateSession. |
| 714 | IPEndPoint local_address_; |
Zhongyi Shi | a0cef108 | 2017-08-25 01:49:50 | [diff] [blame] | 715 | // True if we need to check HttpServerProperties if QUIC was supported last |
| 716 | // time. |
| 717 | bool need_to_check_persisted_supports_quic_; |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 718 | bool prefer_aes_gcm_recorded_; |
rtenneti | fc47e0e | 2014-09-26 02:54:05 | [diff] [blame] | 719 | |
rtenneti | 041b299 | 2015-02-23 23:03:28 | [diff] [blame] | 720 | NetworkConnection network_connection_; |
| 721 | |
ckrasic | 3865ee0f | 2016-02-29 22:04:56 | [diff] [blame] | 722 | int num_push_streams_created_; |
| 723 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 724 | quic::QuicClientPushPromiseIndex push_promise_index_; |
jri | c533399b | 2016-01-29 07:36:01 | [diff] [blame] | 725 | |
Zhongyi Shi | c16b410 | 2019-02-12 00:37:40 | [diff] [blame] | 726 | const base::TickClock* tick_clock_; |
| 727 | |
Zhongyi Shi | 8fff75b | 2017-11-19 21:36:36 | [diff] [blame] | 728 | base::SequencedTaskRunner* task_runner_; |
rtenneti | 38f5cd5 | 2014-10-28 20:28:28 | [diff] [blame] | 729 | |
Ryan Sleevi | b8449e0 | 2018-07-15 04:31:07 | [diff] [blame] | 730 | SSLConfigService* const ssl_config_service_; |
nharper | 642ae4b | 2016-06-30 00:40:36 | [diff] [blame] | 731 | |
Matt Menke | fca05b6 | 2019-09-20 23:15:56 | [diff] [blame] | 732 | // Whether NetworkIsolationKeys should be used for |
| 733 | // |active_crypto_config_map_|. If false, there will just be one config with |
| 734 | // an empty NetworkIsolationKey. Whether QuicSessionAliasKeys all have an |
| 735 | // empty NIK is based on whether socket pools are respecting NIKs, but whether |
| 736 | // those NIKs are also used when accessing |active_crypto_config_map_| is also |
| 737 | // gated this, which is set based on whether HttpServerProperties is |
| 738 | // respecting NIKs, as that data is fed into the crypto config map using the |
| 739 | // corresponding NIK. |
| 740 | const bool use_network_isolation_key_for_crypto_configs_; |
| 741 | |
Jeremy Roman | d54000b2 | 2019-07-08 18:40:16 | [diff] [blame] | 742 | base::WeakPtrFactory<QuicStreamFactory> weak_factory_{this}; |
[email protected] | 1e96003 | 2013-12-20 19:00:20 | [diff] [blame] | 743 | |
[email protected] | e13201d8 | 2012-12-12 05:00:32 | [diff] [blame] | 744 | DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); |
| 745 | }; |
| 746 | |
| 747 | } // namespace net |
| 748 | |
Ryan Hamilton | a3ee93a7 | 2018-08-01 22:03:08 | [diff] [blame] | 749 | #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ |