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

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

Issue 2318053004: Remove obsolete QUIC disabling code. (Closed)
Patch Set: fix Created 4 years, 3 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const std::string& user_agent_id, 172 const std::string& user_agent_id,
173 const QuicVersionVector& supported_versions, 173 const QuicVersionVector& supported_versions,
174 bool enable_port_selection, 174 bool enable_port_selection,
175 bool always_require_handshake_confirmation, 175 bool always_require_handshake_confirmation,
176 bool disable_connection_pooling, 176 bool disable_connection_pooling,
177 float load_server_info_timeout_srtt_multiplier, 177 float load_server_info_timeout_srtt_multiplier,
178 bool enable_connection_racing, 178 bool enable_connection_racing,
179 bool enable_non_blocking_io, 179 bool enable_non_blocking_io,
180 bool disable_disk_cache, 180 bool disable_disk_cache,
181 bool prefer_aes, 181 bool prefer_aes,
182 int max_number_of_lossy_connections,
183 float packet_loss_threshold,
184 int max_recent_disabled_reasons,
185 int threshold_timeouts_with_streams_open,
186 int threshold_public_resets_post_handshake,
187 int socket_receive_buffer_size, 182 int socket_receive_buffer_size,
188 bool delay_tcp_race, 183 bool delay_tcp_race,
189 int max_server_configs_stored_in_properties, 184 int max_server_configs_stored_in_properties,
190 bool close_sessions_on_ip_change, 185 bool close_sessions_on_ip_change,
191 bool disable_quic_on_timeout_with_open_streams, 186 bool disable_quic_on_timeout_with_open_streams,
192 int idle_connection_timeout_seconds, 187 int idle_connection_timeout_seconds,
193 int reduced_ping_timeout_seconds, 188 int reduced_ping_timeout_seconds,
194 int packet_reader_yield_after_duration_milliseconds, 189 int packet_reader_yield_after_duration_milliseconds,
195 bool migrate_sessions_on_network_change, 190 bool migrate_sessions_on_network_change,
196 bool migrate_sessions_early, 191 bool migrate_sessions_early,
(...skipping 17 matching lines...) Expand all
214 // matching session exists, this will return ERR_IO_PENDING and will invoke 209 // matching session exists, this will return ERR_IO_PENDING and will invoke
215 // OnRequestComplete asynchronously. 210 // OnRequestComplete asynchronously.
216 int Create(const QuicServerId& server_id, 211 int Create(const QuicServerId& server_id,
217 const HostPortPair& destination, 212 const HostPortPair& destination,
218 int cert_verify_flags, 213 int cert_verify_flags,
219 const GURL& url, 214 const GURL& url,
220 base::StringPiece method, 215 base::StringPiece method,
221 const BoundNetLog& net_log, 216 const BoundNetLog& net_log,
222 QuicStreamRequest* request); 217 QuicStreamRequest* request);
223 218
224 // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_| 219 // Called when the handshake for |session| is confirmed. If QUIC is disabled
225 // it marks QUIC as recently broken for the port of the session. Increments 220 // currently disabled, then it closes the connection and returns true.
226 // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_| 221 bool OnHandshakeConfirmed(QuicChromiumClientSession* session);
227 // is greater than or equal to |max_number_of_lossy_connections_| then it
228 // disables QUIC. If QUIC is disabled then it closes the connection.
229 //
230 // Returns true if QUIC is disabled for the port of the session.
231 bool OnHandshakeConfirmed(QuicChromiumClientSession* session,
232 float packet_loss_rate);
233 222
234 // Called when a TCP job completes for an origin that QUIC potentially 223 // Called when a TCP job completes for an origin that QUIC potentially
235 // could be used for. 224 // could be used for.
236 void OnTcpJobCompleted(bool succeeded); 225 void OnTcpJobCompleted(bool succeeded);
237 226
238 // Returns true if QUIC is disabled for this port. 227 // Returns true if QUIC is disabled.
239 bool IsQuicDisabled(uint16_t port) const; 228 bool IsQuicDisabled() const;
240
241 // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not.
242 QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason(
243 uint16_t port) const;
244
245 // Returns reason QUIC is disabled as string for net-internals, or
246 // returns empty string if QUIC is not disabled.
247 const char* QuicDisabledReasonString() const;
248 229
249 // Called by a session when it becomes idle. 230 // Called by a session when it becomes idle.
250 void OnIdleSession(QuicChromiumClientSession* session); 231 void OnIdleSession(QuicChromiumClientSession* session);
251 232
252 // Called by a session when it is going away and no more streams should be 233 // Called by a session when it is going away and no more streams should be
253 // created on it. 234 // created on it.
254 void OnSessionGoingAway(QuicChromiumClientSession* session); 235 void OnSessionGoingAway(QuicChromiumClientSession* session);
255 236
256 // Called by a session after it shuts down. 237 // Called by a session after it shuts down.
257 void OnSessionClosed(QuicChromiumClientSession* session); 238 void OnSessionClosed(QuicChromiumClientSession* session);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 361 }
381 362
382 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; } 363 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; }
383 364
384 bool delay_tcp_race() const { return delay_tcp_race_; } 365 bool delay_tcp_race() const { return delay_tcp_race_; }
385 366
386 private: 367 private:
387 class Job; 368 class Job;
388 class CertVerifierJob; 369 class CertVerifierJob;
389 friend class test::QuicStreamFactoryPeer; 370 friend class test::QuicStreamFactoryPeer;
390 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
391 371
392 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap; 372 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
393 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap; 373 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap;
394 typedef std::set<QuicSessionKey> AliasSet; 374 typedef std::set<QuicSessionKey> AliasSet;
395 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; 375 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap;
396 typedef std::set<QuicChromiumClientSession*> SessionSet; 376 typedef std::set<QuicChromiumClientSession*> SessionSet;
397 typedef std::map<IPEndPoint, SessionSet> IPAliasMap; 377 typedef std::map<IPEndPoint, SessionSet> IPAliasMap;
398 typedef std::map<QuicChromiumClientSession*, IPEndPoint> SessionPeerIPMap; 378 typedef std::map<QuicChromiumClientSession*, IPEndPoint> SessionPeerIPMap;
399 typedef std::set<Job*> JobSet; 379 typedef std::set<Job*> JobSet;
400 typedef std::map<QuicServerId, JobSet> JobMap; 380 typedef std::map<QuicServerId, JobSet> JobMap;
401 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 381 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
402 typedef std::set<QuicStreamRequest*> RequestSet; 382 typedef std::set<QuicStreamRequest*> RequestSet;
403 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 383 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
404 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
405 DisabledReasonsQueue;
406 typedef std::map<QuicServerId, std::unique_ptr<CertVerifierJob>> 384 typedef std::map<QuicServerId, std::unique_ptr<CertVerifierJob>>
407 CertVerifierJobMap; 385 CertVerifierJobMap;
408 386
409 enum FactoryStatus { 387 enum FactoryStatus {
410 OPEN, // New streams may be created. 388 OPEN, // New streams may be created.
411 CLOSED, // No new streams may be created temporarily. 389 CLOSED, // No new streams may be created temporarily.
412 DISABLED // No more streams may be created until the network changes. 390 DISABLED // No more streams may be created until the network changes.
413 }; 391 };
414 392
415 // Creates a job which doesn't wait for server config to be loaded from the 393 // Creates a job which doesn't wait for server config to be loaded from the
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 445
468 // Initialize |quic_supported_servers_at_startup_| with the list of servers 446 // Initialize |quic_supported_servers_at_startup_| with the list of servers
469 // that supported QUIC at start up and also initialize in-memory cache of 447 // that supported QUIC at start up and also initialize in-memory cache of
470 // QuicServerInfo objects from HttpServerProperties. 448 // QuicServerInfo objects from HttpServerProperties.
471 void MaybeInitialize(); 449 void MaybeInitialize();
472 450
473 void ProcessGoingAwaySession(QuicChromiumClientSession* session, 451 void ProcessGoingAwaySession(QuicChromiumClientSession* session,
474 const QuicServerId& server_id, 452 const QuicServerId& server_id,
475 bool was_session_active); 453 bool was_session_active);
476 454
477 // Collect stats from recent connections, possibly disabling Quic.
478 void MaybeDisableQuic(QuicChromiumClientSession* session);
479
480 void MaybeDisableQuic(uint16_t port);
481
482 // Internal method that migrates |session| over to using 455 // Internal method that migrates |session| over to using
483 // |peer_address| and |network|. If |network| is kInvalidNetworkHandle, 456 // |peer_address| and |network|. If |network| is kInvalidNetworkHandle,
484 // default network is used. If |packet| is not null, it is sent 457 // default network is used. If |packet| is not null, it is sent
485 // on the new network, else a PING frame is sent. 458 // on the new network, else a PING frame is sent.
486 void MigrateSession(QuicChromiumClientSession* session, 459 void MigrateSession(QuicChromiumClientSession* session,
487 IPEndPoint peer_address, 460 IPEndPoint peer_address,
488 NetworkChangeNotifier::NetworkHandle network, 461 NetworkChangeNotifier::NetworkHandle network,
489 bool close_session_on_error, 462 bool close_session_on_error,
490 const BoundNetLog& bound_net_log, 463 const BoundNetLog& bound_net_log,
491 scoped_refptr<StringIOBuffer> packet); 464 scoped_refptr<StringIOBuffer> packet);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 538
566 // Set if experimental non-blocking IO should be used on windows sockets. 539 // Set if experimental non-blocking IO should be used on windows sockets.
567 bool enable_non_blocking_io_; 540 bool enable_non_blocking_io_;
568 541
569 // Set if we do not want to load server config from the disk cache. 542 // Set if we do not want to load server config from the disk cache.
570 bool disable_disk_cache_; 543 bool disable_disk_cache_;
571 544
572 // Set if AES-GCM should be preferred, even if there is no hardware support. 545 // Set if AES-GCM should be preferred, even if there is no hardware support.
573 bool prefer_aes_; 546 bool prefer_aes_;
574 547
575 // Set if we want to disable QUIC when there is high packet loss rate. 548 // True if QUIC should be disabled when there are timeouts with open
576 // Specifies the maximum number of connections with high packet loss in a row 549 // streams.
577 // after which QUIC will be disabled. 550 bool disable_quic_on_timeout_with_open_streams_;
ianswett 2016/09/08 19:37:02 Were you intending to keep this? You removed the
Ryan Hamilton 2016/09/08 19:42:02 Yes, I want this. This is true if we want to try d
578 int max_number_of_lossy_connections_;
579 // Specifies packet loss rate in fraction after which a connection is closed
580 // and is considered as a lossy connection.
581 float packet_loss_threshold_;
582 // Count number of lossy connections by port.
583 std::map<uint16_t, int> number_of_lossy_connections_;
584
585 // Keep track of stats for recently closed connections, using a
586 // bounded queue.
587 int max_disabled_reasons_;
588 DisabledReasonsQueue disabled_reasons_;
589 // Events that can trigger disabling QUIC
590 int num_public_resets_post_handshake_;
591 int num_timeouts_with_open_streams_;
592 // Keep track the largest values for UMA histograms, that will help
593 // determine good threshold values.
594 int max_public_resets_post_handshake_;
595 int max_timeouts_with_open_streams_;
596 // Thresholds if greater than zero, determine when to
597 int threshold_timeouts_with_open_streams_;
598 int threshold_public_resets_post_handshake_;
599 551
600 // Size of the UDP receive buffer. 552 // Size of the UDP receive buffer.
601 int socket_receive_buffer_size_; 553 int socket_receive_buffer_size_;
602 554
603 // Set if we do want to delay TCP connection when it is racing with QUIC. 555 // Set if we do want to delay TCP connection when it is racing with QUIC.
604 bool delay_tcp_race_; 556 bool delay_tcp_race_;
605 557
606 // PING timeout for connections. 558 // PING timeout for connections.
607 QuicTime::Delta ping_timeout_; 559 QuicTime::Delta ping_timeout_;
608 QuicTime::Delta reduced_ping_timeout_; 560 QuicTime::Delta reduced_ping_timeout_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 const scoped_refptr<SSLConfigService> ssl_config_service_; 617 const scoped_refptr<SSLConfigService> ssl_config_service_;
666 618
667 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 619 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
668 620
669 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 621 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
670 }; 622 };
671 623
672 } // namespace net 624 } // namespace net
673 625
674 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 626 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698