Chromium Code Reviews| Index: net/quic/quic_stream_factory.cc |
| diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc |
| index cbcd45eed6f4641b1e701ab9d7fe6a625d307f9b..87f17c440afc8bcba71d8c505679099ae33bd04f 100644 |
| --- a/net/quic/quic_stream_factory.cc |
| +++ b/net/quic/quic_stream_factory.cc |
| @@ -539,6 +539,8 @@ QuicStreamFactory::QuicStreamFactory( |
| bool enable_connection_racing, |
| bool enable_non_blocking_io, |
| bool disable_disk_cache, |
| + int max_number_of_lossy_connections, |
| + float packet_loss_threshold, |
| int socket_receive_buffer_size, |
| const QuicTagVector& connection_options) |
| : require_confirmation_(true), |
| @@ -562,6 +564,10 @@ QuicStreamFactory::QuicStreamFactory( |
| enable_connection_racing_(enable_connection_racing), |
| enable_non_blocking_io_(enable_non_blocking_io), |
| disable_disk_cache_(disable_disk_cache), |
| + max_number_of_lossy_connections_(max_number_of_lossy_connections), |
| + number_of_lossy_connections_(0), |
| + quic_is_disabled_(false), |
| + packet_loss_threshold_(packet_loss_threshold), |
| socket_receive_buffer_size_(socket_receive_buffer_size), |
| port_seed_(random_generator_->RandUint64()), |
| check_persisted_supports_quic_(true), |
| @@ -609,6 +615,9 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair, |
| base::StringPiece method, |
| const BoundNetLog& net_log, |
| QuicStreamRequest* request) { |
| + // TODO(rtenneti): return a better error? |
| + if (quic_is_disabled_) |
| + return ERR_QUIC_PROTOCOL_ERROR; |
|
Ryan Hamilton
2015/03/23 02:31:06
If you do QUIC_HANDSHAKE_FAILED then HttpNetworkTr
ramant (doing other things)
2015/03/24 03:07:22
As we had talked offline, hooked it to HttpStreamF
|
| QuicServerId server_id(host_port_pair, is_https, privacy_mode); |
| if (HasActiveSession(server_id)) { |
| request->set_stream(CreateIfSessionExists(server_id, net_log)); |
| @@ -762,6 +771,25 @@ scoped_ptr<QuicHttpStream> QuicStreamFactory::CreateIfSessionExists( |
| new QuicHttpStream(session->GetWeakPtr())); |
| } |
| +void QuicStreamFactory::OnBadPacketLoss(const QuicServerId& server_id) { |
| + ++number_of_lossy_connections_; |
| + |
| + if (http_server_properties_) { |
| + const HostPortPair& server = server_id.host_port_pair(); |
| + http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
| + AlternativeService(QUIC, server.host(), server.port())); |
| + } |
| + |
| + if (number_of_lossy_connections_ < max_number_of_lossy_connections_ || |
| + quic_is_disabled_) { |
| + return; |
| + } |
| + |
| + quic_is_disabled_ = true; |
| + UMA_HISTOGRAM_BOOLEAN("Net.QuicStreamFactory.QuicIsDisabled", |
| + quic_is_disabled_); |
| +} |
| + |
| void QuicStreamFactory::OnIdleSession(QuicClientSession* session) { |
| } |