blob: 9a19d575b033d211e2e4d603b27a08f8a2677d8b [file] [log] [blame]
[email protected]e13201d82012-12-12 05:00:321// 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
5#ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_
6#define NET_QUIC_QUIC_STREAM_FACTORY_H_
7
[email protected]1cd2a5f2014-03-14 06:33:258#include <list>
[email protected]e13201d82012-12-12 05:00:329#include <map>
[email protected]41d6b172013-01-29 16:10:5710#include <string>
[email protected]6e12d702013-11-13 00:17:1711#include <vector>
[email protected]e13201d82012-12-12 05:00:3212
[email protected]e8cf7555b2014-02-28 23:52:5313#include "base/logging.h"
[email protected]e13201d82012-12-12 05:00:3214#include "base/memory/weak_ptr.h"
15#include "net/base/address_list.h"
16#include "net/base/completion_callback.h"
17#include "net/base/host_port_pair.h"
[email protected]f698a012013-05-06 20:18:5918#include "net/base/network_change_notifier.h"
[email protected]d7d1e50b2013-11-25 22:08:0919#include "net/cert/cert_database.h"
eroman87c53d62015-04-02 06:51:0720#include "net/log/net_log.h"
[email protected]e13201d82012-12-12 05:00:3221#include "net/proxy/proxy_server.h"
rtenneti041b2992015-02-23 23:03:2822#include "net/quic/network_connection.h"
ckrasic1e53b642015-07-08 22:39:3523#include "net/quic/quic_client_session.h"
[email protected]ef95114d2013-04-17 17:57:0124#include "net/quic/quic_config.h"
25#include "net/quic/quic_crypto_stream.h"
[email protected]e13201d82012-12-12 05:00:3226#include "net/quic/quic_http_stream.h"
27#include "net/quic/quic_protocol.h"
28
29namespace net {
30
[email protected]6d1b4ed2013-07-10 03:57:5431class CertVerifier;
[email protected]6b8a3c742014-07-25 00:25:3532class ChannelIDService;
[email protected]e13201d82012-12-12 05:00:3233class ClientSocketFactory;
[email protected]6d1b4ed2013-07-10 03:57:5434class HostResolver;
[email protected]77c6c162013-08-17 02:57:4535class HttpServerProperties;
[email protected]e13201d82012-12-12 05:00:3236class QuicClock;
37class QuicClientSession;
[email protected]2cfc6bb82013-10-27 03:40:4438class QuicConnectionHelper;
[email protected]e8ff26842013-03-22 21:02:0539class QuicCryptoClientStreamFactory;
[email protected]9558c5d32012-12-22 00:08:1440class QuicRandom;
[email protected]7832eeb2014-01-25 10:10:4341class QuicServerInfoFactory;
[email protected]257f24f2014-04-01 09:15:3742class QuicServerId;
[email protected]e13201d82012-12-12 05:00:3243class QuicStreamFactory;
[email protected]080b77932014-08-04 01:22:4644class TransportSecurityState;
[email protected]e13201d82012-12-12 05:00:3245
[email protected]c49ff182013-09-28 08:33:2646namespace test {
47class QuicStreamFactoryPeer;
48} // namespace test
49
[email protected]e13201d82012-12-12 05:00:3250// Encapsulates a pending request for a QuicHttpStream.
51// If the request is still pending when it is destroyed, it will
52// cancel the request with the factory.
53class NET_EXPORT_PRIVATE QuicStreamRequest {
54 public:
55 explicit QuicStreamRequest(QuicStreamFactory* factory);
56 ~QuicStreamRequest();
57
[email protected]0cceb922014-07-01 02:00:5658 // For http, |is_https| is false.
rtennetia75df622015-06-21 23:59:5059 // |cert_verify_flags| is bitwise OR'd of CertVerifier::VerifyFlags and it is
60 // passed to CertVerifier::Verify.
[email protected]bf4ea2f2014-03-10 22:57:5361 int Request(const HostPortPair& host_port_pair,
[email protected]6d1b4ed2013-07-10 03:57:5462 bool is_https,
[email protected]9dd3ff0f2014-03-26 09:51:2863 PrivacyMode privacy_mode,
rtennetia75df622015-06-21 23:59:5064 int cert_verify_flags,
bnc68d401dd2015-05-18 20:31:4865 base::StringPiece origin_host,
[email protected]974849d2014-02-06 01:32:5966 base::StringPiece method,
[email protected]e13201d82012-12-12 05:00:3267 const BoundNetLog& net_log,
68 const CompletionCallback& callback);
69
70 void OnRequestComplete(int rv);
71
72 scoped_ptr<QuicHttpStream> ReleaseStream();
73
74 void set_stream(scoped_ptr<QuicHttpStream> stream);
75
bnccb7ff3c2015-05-21 20:51:5576 const std::string origin_host() const { return origin_host_; }
77
78 PrivacyMode privacy_mode() const { return privacy_mode_; }
79
[email protected]e13201d82012-12-12 05:00:3280 const BoundNetLog& net_log() const{
81 return net_log_;
82 }
83
84 private:
85 QuicStreamFactory* factory_;
[email protected]bf4ea2f2014-03-10 22:57:5386 HostPortPair host_port_pair_;
bnccb7ff3c2015-05-21 20:51:5587 std::string origin_host_;
88 PrivacyMode privacy_mode_;
[email protected]e13201d82012-12-12 05:00:3289 BoundNetLog net_log_;
90 CompletionCallback callback_;
91 scoped_ptr<QuicHttpStream> stream_;
92
93 DISALLOW_COPY_AND_ASSIGN(QuicStreamRequest);
94};
95
96// A factory for creating new QuicHttpStreams on top of a pool of
97// QuicClientSessions.
[email protected]f698a012013-05-06 20:18:5998class NET_EXPORT_PRIVATE QuicStreamFactory
[email protected]d7d1e50b2013-11-25 22:08:0999 : public NetworkChangeNotifier::IPAddressObserver,
100 public CertDatabase::Observer {
[email protected]e13201d82012-12-12 05:00:32101 public:
[email protected]e8ff26842013-03-22 21:02:05102 QuicStreamFactory(
103 HostResolver* host_resolver,
104 ClientSocketFactory* client_socket_factory,
[email protected]77c6c162013-08-17 02:57:45105 base::WeakPtr<HttpServerProperties> http_server_properties,
[email protected]59c0bbd2014-03-22 04:08:12106 CertVerifier* cert_verifier,
[email protected]6b8a3c742014-07-25 00:25:35107 ChannelIDService* channel_id_service,
[email protected]080b77932014-08-04 01:22:46108 TransportSecurityState* transport_security_state,
[email protected]e8ff26842013-03-22 21:02:05109 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory,
110 QuicRandom* random_generator,
[email protected]256fe9b2013-11-27 01:58:02111 QuicClock* clock,
[email protected]1e960032013-12-20 19:00:20112 size_t max_packet_length,
[email protected]0c4017ca2014-06-06 03:30:45113 const std::string& user_agent_id,
[email protected]376d38a2014-01-22 03:47:35114 const QuicVersionVector& supported_versions,
[email protected]c80f7c92014-02-27 13:12:02115 bool enable_port_selection,
jri2b966f22014-09-02 22:25:36116 bool always_require_handshake_confirmation,
jri584002d12014-09-09 00:51:28117 bool disable_connection_pooling,
rtenneti2912825c2015-01-06 01:19:46118 float load_server_info_timeout_srtt_multiplier,
rtenneti4f809972015-02-11 19:38:34119 bool enable_connection_racing,
qyearsley3257b7de2015-02-28 06:59:03120 bool enable_non_blocking_io,
rtenneti34dffe752015-02-24 23:27:32121 bool disable_disk_cache,
rch9976b0c2015-06-10 21:27:23122 bool prefer_aes,
rtenneti85dcfac22015-03-27 20:22:19123 int max_number_of_lossy_connections,
124 float packet_loss_threshold,
ckrasic1e53b642015-07-08 22:39:35125 int max_recent_disabled_reasons,
126 int threshold_timeouts_with_streams_open,
127 int threshold_public_resets_post_handshake,
rchc7433572015-02-27 18:16:51128 int socket_receive_buffer_size,
[email protected]4b4efab32014-07-01 02:36:16129 const QuicTagVector& connection_options);
dchengb03027d2014-10-21 12:00:20130 ~QuicStreamFactory() override;
[email protected]e13201d82012-12-12 05:00:32131
[email protected]bf4ea2f2014-03-10 22:57:53132 // Creates a new QuicHttpStream to |host_port_pair| which will be
[email protected]6d1b4ed2013-07-10 03:57:54133 // owned by |request|. |is_https| specifies if the protocol is https or not.
[email protected]0cceb922014-07-01 02:00:56134 // If a matching session already exists, this method will return OK. If no
135 // matching session exists, this will return ERR_IO_PENDING and will invoke
136 // OnRequestComplete asynchronously.
[email protected]bf4ea2f2014-03-10 22:57:53137 int Create(const HostPortPair& host_port_pair,
[email protected]6d1b4ed2013-07-10 03:57:54138 bool is_https,
[email protected]9dd3ff0f2014-03-26 09:51:28139 PrivacyMode privacy_mode,
rtennetia75df622015-06-21 23:59:50140 int cert_verify_flags,
bnccb7ff3c2015-05-21 20:51:55141 base::StringPiece origin_host,
[email protected]974849d2014-02-06 01:32:59142 base::StringPiece method,
[email protected]e13201d82012-12-12 05:00:32143 const BoundNetLog& net_log,
144 QuicStreamRequest* request);
145
rtenneti97137a92015-06-18 06:00:31146 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_|
147 // it marks QUIC as recently broken for the port of the session. Increments
148 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_|
149 // is greater than or equal to |max_number_of_lossy_connections_| then it
150 // disables QUIC. If QUIC is disabled then it closes the connection.
151 //
152 // Returns true if QUIC is disabled for the port of the session.
rtenneti85dcfac22015-03-27 20:22:19153 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate);
154
155 // Returns true if QUIC is disabled for this port.
156 bool IsQuicDisabled(uint16 port);
157
ckrasic1e53b642015-07-08 22:39:35158 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not.
159 QuicClientSession::QuicDisabledReason QuicDisabledReason(uint16 port) const;
160
161 // Returns reason QUIC is disabled as string for net-internals, or
162 // returns empty string if QUIC is not disabled.
163 const char* QuicDisabledReasonString() const;
164
[email protected]e13201d82012-12-12 05:00:32165 // Called by a session when it becomes idle.
166 void OnIdleSession(QuicClientSession* session);
167
[email protected]4d283b32013-10-17 12:57:27168 // Called by a session when it is going away and no more streams should be
169 // created on it.
170 void OnSessionGoingAway(QuicClientSession* session);
171
[email protected]e13201d82012-12-12 05:00:32172 // Called by a session after it shuts down.
[email protected]4d283b32013-10-17 12:57:27173 void OnSessionClosed(QuicClientSession* session);
[email protected]e13201d82012-12-12 05:00:32174
[email protected]65768442014-06-06 23:37:03175 // Called by a session whose connection has timed out.
176 void OnSessionConnectTimeout(QuicClientSession* session);
177
[email protected]e13201d82012-12-12 05:00:32178 // Cancels a pending request.
179 void CancelRequest(QuicStreamRequest* request);
180
[email protected]56dfb902013-01-03 23:17:55181 // Closes all current sessions.
182 void CloseAllSessions(int error);
183
payal.pandeya18956a2015-05-27 05:57:55184 scoped_ptr<base::Value> QuicStreamFactoryInfoToValue() const;
[email protected]c5b061b2013-01-05 00:31:34185
[email protected]f7e21a432014-04-21 22:17:57186 // Delete all cached state objects in |crypto_config_|.
[email protected]60cf50e2014-04-28 23:23:18187 void ClearCachedStatesInCryptoConfig();
[email protected]f7e21a432014-04-21 22:17:57188
[email protected]f698a012013-05-06 20:18:59189 // NetworkChangeNotifier::IPAddressObserver methods:
190
191 // Until the servers support roaming, close all connections when the local
192 // IP address changes.
dchengb03027d2014-10-21 12:00:20193 void OnIPAddressChanged() override;
[email protected]f698a012013-05-06 20:18:59194
[email protected]d7d1e50b2013-11-25 22:08:09195 // CertDatabase::Observer methods:
196
197 // We close all sessions when certificate database is changed.
dchengb03027d2014-10-21 12:00:20198 void OnCertAdded(const X509Certificate* cert) override;
199 void OnCACertChanged(const X509Certificate* cert) override;
[email protected]d7d1e50b2013-11-25 22:08:09200
jri2b966f22014-09-02 22:25:36201 bool require_confirmation() const {
202 return require_confirmation_;
203 }
[email protected]11c05872013-08-20 02:04:12204
rtennetifc47e0e2014-09-26 02:54:05205 void set_require_confirmation(bool require_confirmation);
[email protected]11c05872013-08-20 02:04:12206
[email protected]2cfc6bb82013-10-27 03:40:44207 QuicConnectionHelper* helper() { return helper_.get(); }
208
[email protected]376d38a2014-01-22 03:47:35209 bool enable_port_selection() const { return enable_port_selection_; }
210
[email protected]a4205202014-06-02 16:03:08211 bool has_quic_server_info_factory() {
212 return quic_server_info_factory_ != NULL;
213 }
214
[email protected]e8cf7555b2014-02-28 23:52:53215 void set_quic_server_info_factory(
216 QuicServerInfoFactory* quic_server_info_factory) {
217 DCHECK(!quic_server_info_factory_);
218 quic_server_info_factory_ = quic_server_info_factory;
219 }
220
rtenneti14abd312015-02-06 21:56:01221 bool enable_connection_racing() const { return enable_connection_racing_; }
222 void set_enable_connection_racing(bool enable_connection_racing) {
223 enable_connection_racing_ = enable_connection_racing;
224 }
225
[email protected]e13201d82012-12-12 05:00:32226 private:
227 class Job;
[email protected]c49ff182013-09-28 08:33:26228 friend class test::QuicStreamFactoryPeer;
tbansala5268e22015-06-30 02:57:58229 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
[email protected]e13201d82012-12-12 05:00:32230
[email protected]9dd3ff0f2014-03-26 09:51:28231 // The key used to find session by ip. Includes
[email protected]df157d9d2014-03-10 07:27:27232 // the ip address, port, and scheme.
233 struct NET_EXPORT_PRIVATE IpAliasKey {
234 IpAliasKey();
235 IpAliasKey(IPEndPoint ip_endpoint, bool is_https);
236 ~IpAliasKey();
237
238 IPEndPoint ip_endpoint;
239 bool is_https;
240
241 // Needed to be an element of std::set.
242 bool operator<(const IpAliasKey &other) const;
243 bool operator==(const IpAliasKey &other) const;
244 };
245
[email protected]257f24f2014-04-01 09:15:37246 typedef std::map<QuicServerId, QuicClientSession*> SessionMap;
[email protected]4d590c9c2014-05-02 05:14:33247 typedef std::map<QuicClientSession*, QuicServerId> SessionIdMap;
[email protected]257f24f2014-04-01 09:15:37248 typedef std::set<QuicServerId> AliasSet;
[email protected]e13201d82012-12-12 05:00:32249 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap;
250 typedef std::set<QuicClientSession*> SessionSet;
[email protected]df157d9d2014-03-10 07:27:27251 typedef std::map<IpAliasKey, SessionSet> IPAliasMap;
[email protected]257f24f2014-04-01 09:15:37252 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
rtenneti14abd312015-02-06 21:56:01253 typedef std::set<Job*> JobSet;
254 typedef std::map<QuicServerId, JobSet> JobMap;
255 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
[email protected]e13201d82012-12-12 05:00:32256 typedef std::set<QuicStreamRequest*> RequestSet;
rtenneti14abd312015-02-06 21:56:01257 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
ckrasic1e53b642015-07-08 22:39:35258 typedef std::deque<enum QuicClientSession::QuicDisabledReason>
259 DisabledReasonsQueue;
rtenneti14abd312015-02-06 21:56:01260
261 // Creates a job which doesn't wait for server config to be loaded from the
262 // disk cache. This job is started via a PostTask.
263 void CreateAuxilaryJob(const QuicServerId server_id,
rtennetia75df622015-06-21 23:59:50264 int cert_verify_flags,
bnc68d401dd2015-05-18 20:31:48265 bool server_and_origin_have_same_host,
rtenneti14abd312015-02-06 21:56:01266 bool is_post,
267 const BoundNetLog& net_log);
[email protected]e13201d82012-12-12 05:00:32268
bnccb7ff3c2015-05-21 20:51:55269 // Returns a newly created QuicHttpStream owned by the caller.
270 scoped_ptr<QuicHttpStream> CreateFromSession(QuicClientSession*);
[email protected]df157d9d2014-03-10 07:27:27271
[email protected]257f24f2014-04-01 09:15:37272 bool OnResolution(const QuicServerId& server_id,
[email protected]eed749f92013-12-23 18:57:38273 const AddressList& address_list);
[email protected]e13201d82012-12-12 05:00:32274 void OnJobComplete(Job* job, int rv);
[email protected]257f24f2014-04-01 09:15:37275 bool HasActiveSession(const QuicServerId& server_id) const;
276 bool HasActiveJob(const QuicServerId& server_id) const;
277 int CreateSession(const QuicServerId& server_id,
rtennetia75df622015-06-21 23:59:50278 int cert_verify_flags,
[email protected]17bf15c2014-03-14 10:08:04279 scoped_ptr<QuicServerInfo> quic_server_info,
[email protected]338e7982013-12-13 11:15:32280 const AddressList& address_list,
rtennetif4f08852015-02-27 17:50:04281 base::TimeTicks dns_resolution_end_time,
[email protected]338e7982013-12-13 11:15:32282 const BoundNetLog& net_log,
283 QuicClientSession** session);
[email protected]257f24f2014-04-01 09:15:37284 void ActivateSession(const QuicServerId& key,
[email protected]e13201d82012-12-12 05:00:32285 QuicClientSession* session);
286
rtenneti2912825c2015-01-06 01:19:46287 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there
288 // is no |http_server_properties_| or if |http_server_properties_| doesn't
289 // have ServerNetworkStats for the given |server_id|.
290 int64 GetServerNetworkStatsSmoothedRttInMicroseconds(
291 const QuicServerId& server_id) const;
292
bnccacc0992015-03-20 20:22:22293 // Helper methods.
294 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const;
rtenneti14abd312015-02-06 21:56:01295 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id);
296
[email protected]257f24f2014-04-01 09:15:37297 // Initializes the cached state associated with |server_id| in
[email protected]59c0bbd2014-03-22 04:08:12298 // |crypto_config_| with the information in |server_info|.
[email protected]60cf50e2014-04-28 23:23:18299 void InitializeCachedStateInCryptoConfig(
300 const QuicServerId& server_id,
301 const scoped_ptr<QuicServerInfo>& server_info);
[email protected]b694e48c2014-03-18 17:10:13302
[email protected]4d590c9c2014-05-02 05:14:33303 void ProcessGoingAwaySession(QuicClientSession* session,
[email protected]eb71ab62014-05-23 07:57:53304 const QuicServerId& server_id,
305 bool was_session_active);
[email protected]4d590c9c2014-05-02 05:14:33306
ckrasic1e53b642015-07-08 22:39:35307 // Collect stats from recent connections, possibly disabling Quic.
308 void MaybeDisableQuic(QuicClientSession* session);
309
[email protected]11c05872013-08-20 02:04:12310 bool require_confirmation_;
[email protected]e13201d82012-12-12 05:00:32311 HostResolver* host_resolver_;
312 ClientSocketFactory* client_socket_factory_;
[email protected]77c6c162013-08-17 02:57:45313 base::WeakPtr<HttpServerProperties> http_server_properties_;
[email protected]5db452202014-08-19 05:22:15314 TransportSecurityState* transport_security_state_;
[email protected]7832eeb2014-01-25 10:10:43315 QuicServerInfoFactory* quic_server_info_factory_;
[email protected]e8ff26842013-03-22 21:02:05316 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_;
[email protected]9558c5d32012-12-22 00:08:14317 QuicRandom* random_generator_;
[email protected]f1e97e92012-12-16 04:53:25318 scoped_ptr<QuicClock> clock_;
[email protected]256fe9b2013-11-27 01:58:02319 const size_t max_packet_length_;
[email protected]e13201d82012-12-12 05:00:32320
[email protected]2cfc6bb82013-10-27 03:40:44321 // The helper used for all connections.
322 scoped_ptr<QuicConnectionHelper> helper_;
323
[email protected]e13201d82012-12-12 05:00:32324 // Contains owning pointers to all sessions that currently exist.
[email protected]4d590c9c2014-05-02 05:14:33325 SessionIdMap all_sessions_;
[email protected]e13201d82012-12-12 05:00:32326 // Contains non-owning pointers to currently active session
327 // (not going away session, once they're implemented).
328 SessionMap active_sessions_;
[email protected]eed749f92013-12-23 18:57:38329 // Map from session to set of aliases that this session is known by.
[email protected]e13201d82012-12-12 05:00:32330 SessionAliasMap session_aliases_;
[email protected]eed749f92013-12-23 18:57:38331 // Map from IP address to sessions which are connected to this address.
332 IPAliasMap ip_aliases_;
[email protected]e13201d82012-12-12 05:00:32333
[email protected]d8e2abf82014-03-06 10:30:10334 // Origins which have gone away recently.
335 AliasSet gone_away_aliases_;
336
[email protected]fd276a282014-06-11 04:26:14337 const QuicConfig config_;
[email protected]59c0bbd2014-03-22 04:08:12338 QuicCryptoClientConfig crypto_config_;
[email protected]b064310782013-05-30 21:12:17339
[email protected]e13201d82012-12-12 05:00:32340 JobMap active_jobs_;
rtenneti14abd312015-02-06 21:56:01341 ServerIDRequestsMap job_requests_map_;
[email protected]e13201d82012-12-12 05:00:32342 RequestMap active_requests_;
343
[email protected]1e960032013-12-20 19:00:20344 QuicVersionVector supported_versions_;
[email protected]e13201d82012-12-12 05:00:32345
[email protected]376d38a2014-01-22 03:47:35346 // Determine if we should consistently select a client UDP port. If false,
347 // then we will just let the OS select a random client port for each new
348 // connection.
349 bool enable_port_selection_;
350
jri2b966f22014-09-02 22:25:36351 // Set if we always require handshake confirmation. If true, this will
352 // introduce at least one RTT for the handshake before the client sends data.
353 bool always_require_handshake_confirmation_;
354
jri584002d12014-09-09 00:51:28355 // Set if we do not want connection pooling.
356 bool disable_connection_pooling_;
357
rtenneti2912825c2015-01-06 01:19:46358 // Specifies the ratio between time to load QUIC server information from disk
359 // cache to 'smoothed RTT'. This ratio is used to calculate the timeout in
360 // milliseconds to wait for loading of QUIC server information. If we don't
361 // want to timeout, set |load_server_info_timeout_srtt_multiplier_| to 0.
362 float load_server_info_timeout_srtt_multiplier_;
363
rtenneti14abd312015-02-06 21:56:01364 // Set if we want to race connections - one connection that sends
365 // INCHOATE_HELLO and another connection that sends CHLO after loading server
366 // config from the disk cache.
367 bool enable_connection_racing_;
368
qyearsley3257b7de2015-02-28 06:59:03369 // Set if experimental non-blocking IO should be used on windows sockets.
370 bool enable_non_blocking_io_;
371
rtenneti34dffe752015-02-24 23:27:32372 // Set if we do not want to load server config from the disk cache.
373 bool disable_disk_cache_;
374
rch9976b0c2015-06-10 21:27:23375 // Set if AES-GCM should be preferred, even if there is no hardware support.
376 bool prefer_aes_;
377
rtenneti85dcfac22015-03-27 20:22:19378 // Set if we want to disable QUIC when there is high packet loss rate.
379 // Specifies the maximum number of connections with high packet loss in a row
380 // after which QUIC will be disabled.
381 int max_number_of_lossy_connections_;
rtenneti374e56882015-03-28 13:49:54382 // Specifies packet loss rate in fraction after which a connection is closed
rtenneti85dcfac22015-03-27 20:22:19383 // and is considered as a lossy connection.
384 float packet_loss_threshold_;
385 // Count number of lossy connections by port.
386 std::map<uint16, int> number_of_lossy_connections_;
387
ckrasic1e53b642015-07-08 22:39:35388 // Keep track of stats for recently closed connections, using a
389 // bounded queue.
390 int max_disabled_reasons_;
391 DisabledReasonsQueue disabled_reasons_;
392 // Events that can trigger disabling QUIC
393 int num_public_resets_post_handshake_;
394 int num_timeouts_with_open_streams_;
395 // Keep track the largest values for UMA histograms, that will help
396 // determine good threshold values.
397 int max_public_resets_post_handshake_;
398 int max_timeouts_with_open_streams_;
399 // Thresholds if greater than zero, determine when to
400 int threshold_timeouts_with_open_streams_;
401 int threshold_public_resets_post_handshake_;
402
rchc7433572015-02-27 18:16:51403 // Size of the UDP receive buffer.
404 int socket_receive_buffer_size_;
405
406 // Each profile will (probably) have a unique port_seed_ value. This value
407 // is used to help seed a pseudo-random number generator (PortSuggester) so
408 // that we consistently (within this profile) suggest the same ephemeral
409 // port when we re-connect to any given server/port. The differences between
410 // profiles (probablistically) prevent two profiles from colliding in their
411 // ephemeral port requests.
[email protected]337e1452013-12-16 23:57:50412 uint64 port_seed_;
[email protected]7034cf12013-12-13 22:47:07413
rtennetifc47e0e2014-09-26 02:54:05414 // Local address of socket that was created in CreateSession.
415 IPEndPoint local_address_;
416 bool check_persisted_supports_quic_;
rtenneti1681f852014-11-13 20:34:03417 std::set<HostPortPair> quic_supported_servers_at_startup_;
rtennetifc47e0e2014-09-26 02:54:05418
rtenneti041b2992015-02-23 23:03:28419 NetworkConnection network_connection_;
420
rtenneti38f5cd52014-10-28 20:28:28421 base::TaskRunner* task_runner_;
422
[email protected]1e960032013-12-20 19:00:20423 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
424
[email protected]e13201d82012-12-12 05:00:32425 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
426};
427
428} // namespace net
429
430#endif // NET_QUIC_QUIC_STREAM_FACTORY_H_