| Index: net/quic/chromium/quic_stream_factory.h
|
| diff --git a/net/quic/chromium/quic_stream_factory.h b/net/quic/chromium/quic_stream_factory.h
|
| index ef0cf91442a622e6324a16c486ccc86a50062249..c955bcae0ed1fe42c81d91b9f8c3cb6278e821c0 100644
|
| --- a/net/quic/chromium/quic_stream_factory.h
|
| +++ b/net/quic/chromium/quic_stream_factory.h
|
| @@ -179,6 +179,11 @@
|
| bool enable_non_blocking_io,
|
| bool disable_disk_cache,
|
| bool prefer_aes,
|
| + int max_number_of_lossy_connections,
|
| + float packet_loss_threshold,
|
| + int max_recent_disabled_reasons,
|
| + int threshold_timeouts_with_streams_open,
|
| + int threshold_public_resets_post_handshake,
|
| int socket_receive_buffer_size,
|
| bool delay_tcp_race,
|
| int max_server_configs_stored_in_properties,
|
| @@ -216,16 +221,30 @@
|
| const BoundNetLog& net_log,
|
| QuicStreamRequest* request);
|
|
|
| - // Called when the handshake for |session| is confirmed. If QUIC is disabled
|
| - // currently disabled, then it closes the connection and returns true.
|
| - bool OnHandshakeConfirmed(QuicChromiumClientSession* session);
|
| + // If |packet_loss_rate| is greater than or equal to |packet_loss_threshold_|
|
| + // it marks QUIC as recently broken for the port of the session. Increments
|
| + // |number_of_lossy_connections_| by port. If |number_of_lossy_connections_|
|
| + // is greater than or equal to |max_number_of_lossy_connections_| then it
|
| + // disables QUIC. If QUIC is disabled then it closes the connection.
|
| + //
|
| + // Returns true if QUIC is disabled for the port of the session.
|
| + bool OnHandshakeConfirmed(QuicChromiumClientSession* session,
|
| + float packet_loss_rate);
|
|
|
| // Called when a TCP job completes for an origin that QUIC potentially
|
| // could be used for.
|
| void OnTcpJobCompleted(bool succeeded);
|
|
|
| - // Returns true if QUIC is disabled.
|
| - bool IsQuicDisabled() const;
|
| + // Returns true if QUIC is disabled for this port.
|
| + bool IsQuicDisabled(uint16_t port) const;
|
| +
|
| + // Returns reason QUIC is disabled for this port, or QUIC_DISABLED_NOT if not.
|
| + QuicChromiumClientSession::QuicDisabledReason QuicDisabledReason(
|
| + uint16_t port) const;
|
| +
|
| + // Returns reason QUIC is disabled as string for net-internals, or
|
| + // returns empty string if QUIC is not disabled.
|
| + const char* QuicDisabledReasonString() const;
|
|
|
| // Called by a session when it becomes idle.
|
| void OnIdleSession(QuicChromiumClientSession* session);
|
| @@ -368,6 +387,7 @@
|
| class Job;
|
| class CertVerifierJob;
|
| friend class test::QuicStreamFactoryPeer;
|
| + FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
|
|
|
| typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
|
| typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap;
|
| @@ -381,6 +401,8 @@
|
| typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
|
| typedef std::set<QuicStreamRequest*> RequestSet;
|
| typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
|
| + typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
|
| + DisabledReasonsQueue;
|
| typedef std::map<QuicServerId, std::unique_ptr<CertVerifierJob>>
|
| CertVerifierJobMap;
|
|
|
| @@ -452,6 +474,11 @@
|
| const QuicServerId& server_id,
|
| bool was_session_active);
|
|
|
| + // Collect stats from recent connections, possibly disabling Quic.
|
| + void MaybeDisableQuic(QuicChromiumClientSession* session);
|
| +
|
| + void MaybeDisableQuic(uint16_t port);
|
| +
|
| // Internal method that migrates |session| over to using
|
| // |peer_address| and |network|. If |network| is kInvalidNetworkHandle,
|
| // default network is used. If |packet| is not null, it is sent
|
| @@ -545,9 +572,30 @@
|
| // Set if AES-GCM should be preferred, even if there is no hardware support.
|
| bool prefer_aes_;
|
|
|
| - // True if QUIC should be disabled when there are timeouts with open
|
| - // streams.
|
| - bool disable_quic_on_timeout_with_open_streams_;
|
| + // Set if we want to disable QUIC when there is high packet loss rate.
|
| + // Specifies the maximum number of connections with high packet loss in a row
|
| + // after which QUIC will be disabled.
|
| + int max_number_of_lossy_connections_;
|
| + // Specifies packet loss rate in fraction after which a connection is closed
|
| + // and is considered as a lossy connection.
|
| + float packet_loss_threshold_;
|
| + // Count number of lossy connections by port.
|
| + std::map<uint16_t, int> number_of_lossy_connections_;
|
| +
|
| + // Keep track of stats for recently closed connections, using a
|
| + // bounded queue.
|
| + int max_disabled_reasons_;
|
| + DisabledReasonsQueue disabled_reasons_;
|
| + // Events that can trigger disabling QUIC
|
| + int num_public_resets_post_handshake_;
|
| + int num_timeouts_with_open_streams_;
|
| + // Keep track the largest values for UMA histograms, that will help
|
| + // determine good threshold values.
|
| + int max_public_resets_post_handshake_;
|
| + int max_timeouts_with_open_streams_;
|
| + // Thresholds if greater than zero, determine when to
|
| + int threshold_timeouts_with_open_streams_;
|
| + int threshold_public_resets_post_handshake_;
|
|
|
| // Size of the UDP receive buffer.
|
| int socket_receive_buffer_size_;
|
|
|