Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: net/quic/quic_stream_factory.h

Issue 1208933004: QUIC - disable QUIC under recent pathological connection errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_
6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 24 matching lines...) Expand all
35 class QuicClock; 35 class QuicClock;
36 class QuicClientSession; 36 class QuicClientSession;
37 class QuicConnectionHelper; 37 class QuicConnectionHelper;
38 class QuicCryptoClientStreamFactory; 38 class QuicCryptoClientStreamFactory;
39 class QuicRandom; 39 class QuicRandom;
40 class QuicServerInfoFactory; 40 class QuicServerInfoFactory;
41 class QuicServerId; 41 class QuicServerId;
42 class QuicStreamFactory; 42 class QuicStreamFactory;
43 class TransportSecurityState; 43 class TransportSecurityState;
44 44
45 enum QuicClientSessionEpitaph;
46
45 namespace test { 47 namespace test {
46 class QuicStreamFactoryPeer; 48 class QuicStreamFactoryPeer;
47 } // namespace test 49 } // namespace test
48 50
49 // Encapsulates a pending request for a QuicHttpStream. 51 // Encapsulates a pending request for a QuicHttpStream.
50 // If the request is still pending when it is destroyed, it will 52 // If the request is still pending when it is destroyed, it will
51 // cancel the request with the factory. 53 // cancel the request with the factory.
52 class NET_EXPORT_PRIVATE QuicStreamRequest { 54 class NET_EXPORT_PRIVATE QuicStreamRequest {
53 public: 55 public:
54 explicit QuicStreamRequest(QuicStreamFactory* factory); 56 explicit QuicStreamRequest(QuicStreamFactory* factory);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool enable_port_selection, 116 bool enable_port_selection,
115 bool always_require_handshake_confirmation, 117 bool always_require_handshake_confirmation,
116 bool disable_connection_pooling, 118 bool disable_connection_pooling,
117 float load_server_info_timeout_srtt_multiplier, 119 float load_server_info_timeout_srtt_multiplier,
118 bool enable_connection_racing, 120 bool enable_connection_racing,
119 bool enable_non_blocking_io, 121 bool enable_non_blocking_io,
120 bool disable_disk_cache, 122 bool disable_disk_cache,
121 bool prefer_aes, 123 bool prefer_aes,
122 int max_number_of_lossy_connections, 124 int max_number_of_lossy_connections,
123 float packet_loss_threshold, 125 float packet_loss_threshold,
126 int max_epitaphs,
127 int threshold_timeouts_streams_open,
128 int threshold_public_resets_post_handshake,
124 int socket_receive_buffer_size, 129 int socket_receive_buffer_size,
125 const QuicTagVector& connection_options); 130 const QuicTagVector& connection_options);
126 ~QuicStreamFactory() override; 131 ~QuicStreamFactory() override;
127 132
128 // Creates a new QuicHttpStream to |host_port_pair| which will be 133 // Creates a new QuicHttpStream to |host_port_pair| which will be
129 // owned by |request|. |is_https| specifies if the protocol is https or not. 134 // owned by |request|. |is_https| specifies if the protocol is https or not.
130 // If a matching session already exists, this method will return OK. If no 135 // If a matching session already exists, this method will return OK. If no
131 // matching session exists, this will return ERR_IO_PENDING and will invoke 136 // matching session exists, this will return ERR_IO_PENDING and will invoke
132 // OnRequestComplete asynchronously. 137 // OnRequestComplete asynchronously.
133 int Create(const HostPortPair& host_port_pair, 138 int Create(const HostPortPair& host_port_pair,
(...skipping 10 matching lines...) Expand all
144 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| 149 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_|
145 // is greater than or equal to |max_number_of_lossy_connections_| then it 150 // is greater than or equal to |max_number_of_lossy_connections_| then it
146 // disables QUIC. If QUIC is disabled then it closes the connection. 151 // disables QUIC. If QUIC is disabled then it closes the connection.
147 // 152 //
148 // Returns true if QUIC is disabled for the port of the session. 153 // Returns true if QUIC is disabled for the port of the session.
149 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate); 154 bool OnHandshakeConfirmed(QuicClientSession* session, float packet_loss_rate);
150 155
151 // Returns true if QUIC is disabled for this port. 156 // Returns true if QUIC is disabled for this port.
152 bool IsQuicDisabled(uint16 port); 157 bool IsQuicDisabled(uint16 port);
153 158
159 // Returns reason QUIC is disabled for this port, or QUIC_NO_ERROR if not.
160 QuicErrorCode QuicDisabledReason(uint16 port);
Ryan Hamilton 2015/06/30 18:55:32 Instead of QuicErrorCodes (which intended as on-th
Buck 2015/07/01 19:06:20 I went with QuicDisabledReason in quic_types.h
161
154 // Called by a session when it becomes idle. 162 // Called by a session when it becomes idle.
155 void OnIdleSession(QuicClientSession* session); 163 void OnIdleSession(QuicClientSession* session);
156 164
157 // Called by a session when it is going away and no more streams should be 165 // Called by a session when it is going away and no more streams should be
158 // created on it. 166 // created on it.
159 void OnSessionGoingAway(QuicClientSession* session); 167 void OnSessionGoingAway(QuicClientSession* session);
160 168
161 // Called by a session after it shuts down. 169 // Called by a session after it shuts down.
162 void OnSessionClosed(QuicClientSession* session); 170 void OnSessionClosed(QuicClientSession* session);
163 171
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap; 245 typedef std::map<QuicClientSession*, AliasSet> SessionAliasMap;
238 typedef std::set<QuicClientSession*> SessionSet; 246 typedef std::set<QuicClientSession*> SessionSet;
239 typedef std::map<IpAliasKey, SessionSet> IPAliasMap; 247 typedef std::map<IpAliasKey, SessionSet> IPAliasMap;
240 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; 248 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
241 typedef std::set<Job*> JobSet; 249 typedef std::set<Job*> JobSet;
242 typedef std::map<QuicServerId, JobSet> JobMap; 250 typedef std::map<QuicServerId, JobSet> JobMap;
243 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 251 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
244 typedef std::set<QuicStreamRequest*> RequestSet; 252 typedef std::set<QuicStreamRequest*> RequestSet;
245 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 253 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
246 254
255 typedef std::deque<QuicClientSessionEpitaph> EpitaphsQueue;
Ryan Hamilton 2015/06/30 18:55:32 nit: remove the newline before to be consistent wi
Buck 2015/07/01 19:06:20 Done.
256
247 // Creates a job which doesn't wait for server config to be loaded from the 257 // Creates a job which doesn't wait for server config to be loaded from the
248 // disk cache. This job is started via a PostTask. 258 // disk cache. This job is started via a PostTask.
249 void CreateAuxilaryJob(const QuicServerId server_id, 259 void CreateAuxilaryJob(const QuicServerId server_id,
250 int cert_verify_flags, 260 int cert_verify_flags,
251 bool server_and_origin_have_same_host, 261 bool server_and_origin_have_same_host,
252 bool is_post, 262 bool is_post,
253 const BoundNetLog& net_log); 263 const BoundNetLog& net_log);
254 264
255 // Returns a newly created QuicHttpStream owned by the caller. 265 // Returns a newly created QuicHttpStream owned by the caller.
256 scoped_ptr<QuicHttpStream> CreateFromSession(QuicClientSession*); 266 scoped_ptr<QuicHttpStream> CreateFromSession(QuicClientSession*);
(...skipping 26 matching lines...) Expand all
283 // Initializes the cached state associated with |server_id| in 293 // Initializes the cached state associated with |server_id| in
284 // |crypto_config_| with the information in |server_info|. 294 // |crypto_config_| with the information in |server_info|.
285 void InitializeCachedStateInCryptoConfig( 295 void InitializeCachedStateInCryptoConfig(
286 const QuicServerId& server_id, 296 const QuicServerId& server_id,
287 const scoped_ptr<QuicServerInfo>& server_info); 297 const scoped_ptr<QuicServerInfo>& server_info);
288 298
289 void ProcessGoingAwaySession(QuicClientSession* session, 299 void ProcessGoingAwaySession(QuicClientSession* session,
290 const QuicServerId& server_id, 300 const QuicServerId& server_id,
291 bool was_session_active); 301 bool was_session_active);
292 302
303 // Collect stats from epitaphs, possibly disabling Quic.
304 void MaybeDisableQuic(QuicClientSession* session);
305
293 bool require_confirmation_; 306 bool require_confirmation_;
294 HostResolver* host_resolver_; 307 HostResolver* host_resolver_;
295 ClientSocketFactory* client_socket_factory_; 308 ClientSocketFactory* client_socket_factory_;
296 base::WeakPtr<HttpServerProperties> http_server_properties_; 309 base::WeakPtr<HttpServerProperties> http_server_properties_;
297 TransportSecurityState* transport_security_state_; 310 TransportSecurityState* transport_security_state_;
298 QuicServerInfoFactory* quic_server_info_factory_; 311 QuicServerInfoFactory* quic_server_info_factory_;
299 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_; 312 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory_;
300 QuicRandom* random_generator_; 313 QuicRandom* random_generator_;
301 scoped_ptr<QuicClock> clock_; 314 scoped_ptr<QuicClock> clock_;
302 const size_t max_packet_length_; 315 const size_t max_packet_length_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Set if we want to disable QUIC when there is high packet loss rate. 374 // Set if we want to disable QUIC when there is high packet loss rate.
362 // Specifies the maximum number of connections with high packet loss in a row 375 // Specifies the maximum number of connections with high packet loss in a row
363 // after which QUIC will be disabled. 376 // after which QUIC will be disabled.
364 int max_number_of_lossy_connections_; 377 int max_number_of_lossy_connections_;
365 // Specifies packet loss rate in fraction after which a connection is closed 378 // Specifies packet loss rate in fraction after which a connection is closed
366 // and is considered as a lossy connection. 379 // and is considered as a lossy connection.
367 float packet_loss_threshold_; 380 float packet_loss_threshold_;
368 // Count number of lossy connections by port. 381 // Count number of lossy connections by port.
369 std::map<uint16, int> number_of_lossy_connections_; 382 std::map<uint16, int> number_of_lossy_connections_;
370 383
384 // Keep track of stats for recently departed connections, using a
Ryan Hamilton 2015/06/30 18:55:32 nit: instead of "departed", how about "closed" whi
Buck 2015/07/01 19:06:20 Done.
385 // bounded queue.
386 int max_epitaphs_;
387 EpitaphsQueue epitaphs_;
388 // Events that can trigger disaabling QUIC
Ryan Hamilton 2015/06/30 18:55:32 nit: disaabling -> disabling
Buck 2015/07/01 19:06:19 Done.
389 int public_resets_post_handshake_;
Ryan Hamilton 2015/06/30 18:55:32 nit: num_public_resets_post_handshake_ and num_tim
Buck 2015/07/01 19:06:20 Done.
390 int timeouts_streams_open_;
391 // Keep track the largest values for UMA histograms, that will help
392 // determine good threshold values.
393 int max_public_resets_post_handshake_;
394 int max_timeouts_streams_open_;
395 // Thresholds if greater than zero, determine when to
396 int threshold_timeouts_streams_open_;
397 int threshold_public_resets_post_handshake_;
398
371 // Size of the UDP receive buffer. 399 // Size of the UDP receive buffer.
372 int socket_receive_buffer_size_; 400 int socket_receive_buffer_size_;
373 401
374 // Each profile will (probably) have a unique port_seed_ value. This value 402 // Each profile will (probably) have a unique port_seed_ value. This value
375 // is used to help seed a pseudo-random number generator (PortSuggester) so 403 // is used to help seed a pseudo-random number generator (PortSuggester) so
376 // that we consistently (within this profile) suggest the same ephemeral 404 // that we consistently (within this profile) suggest the same ephemeral
377 // port when we re-connect to any given server/port. The differences between 405 // port when we re-connect to any given server/port. The differences between
378 // profiles (probablistically) prevent two profiles from colliding in their 406 // profiles (probablistically) prevent two profiles from colliding in their
379 // ephemeral port requests. 407 // ephemeral port requests.
380 uint64 port_seed_; 408 uint64 port_seed_;
381 409
382 // Local address of socket that was created in CreateSession. 410 // Local address of socket that was created in CreateSession.
383 IPEndPoint local_address_; 411 IPEndPoint local_address_;
384 bool check_persisted_supports_quic_; 412 bool check_persisted_supports_quic_;
385 std::set<HostPortPair> quic_supported_servers_at_startup_; 413 std::set<HostPortPair> quic_supported_servers_at_startup_;
386 414
387 NetworkConnection network_connection_; 415 NetworkConnection network_connection_;
388 416
389 base::TaskRunner* task_runner_; 417 base::TaskRunner* task_runner_;
390 418
391 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 419 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
392 420
393 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 421 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
394 }; 422 };
395 423
396 } // namespace net 424 } // namespace net
397 425
398 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 426 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698