| Index: net/quic/quic_stream_factory.cc
|
| diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
|
| index 2e8508d7629c8b3544862762e524d087b54e8729..9c751575332ec20b62ca38356356c3b398e9fa70 100644
|
| --- a/net/quic/quic_stream_factory.cc
|
| +++ b/net/quic/quic_stream_factory.cc
|
| @@ -436,7 +436,8 @@ int QuicStreamFactory::Job::DoConnect() {
|
| return ERR_QUIC_PROTOCOL_ERROR;
|
| }
|
| bool require_confirmation =
|
| - factory_->require_confirmation() || is_post_ ||
|
| + factory_->require_confirmation() ||
|
| + is_post_ ||
|
| was_alternate_protocol_recently_broken_;
|
|
|
| rv = session_->CryptoConnect(
|
| @@ -539,6 +540,8 @@ QuicStreamFactory::QuicStreamFactory(
|
| bool enable_connection_racing,
|
| bool enable_non_blocking_io,
|
| bool disable_disk_cache,
|
| + int number_of_lossy_handshakes,
|
| + int packet_loss_threshold,
|
| int socket_receive_buffer_size,
|
| const QuicTagVector& connection_options)
|
| : require_confirmation_(true),
|
| @@ -562,6 +565,10 @@ QuicStreamFactory::QuicStreamFactory(
|
| enable_connection_racing_(enable_connection_racing),
|
| enable_non_blocking_io_(enable_non_blocking_io),
|
| disable_disk_cache_(disable_disk_cache),
|
| + number_of_lossy_handshakes_(number_of_lossy_handshakes),
|
| + packet_loss_threshold_(packet_loss_threshold),
|
| + disable_zero_rtt_(number_of_lossy_handshakes_ > 0 &&
|
| + packet_loss_threshold_ > 0),
|
| socket_receive_buffer_size_(socket_receive_buffer_size),
|
| port_seed_(random_generator_->RandUint64()),
|
| check_persisted_supports_quic_(true),
|
| @@ -628,7 +635,7 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
|
|
|
| QuicServerInfo* quic_server_info = nullptr;
|
| if (quic_server_info_factory_) {
|
| - bool load_from_disk_cache = !disable_disk_cache_;
|
| + bool load_from_disk_cache = !disable_disk_cache_ || !disable_zero_rtt_;
|
| if (http_server_properties_) {
|
| const AlternateProtocolMap& alternate_protocol_map =
|
| http_server_properties_->alternate_protocol_map();
|
| @@ -763,6 +770,36 @@ scoped_ptr<QuicHttpStream> QuicStreamFactory::CreateIfSessionExists(
|
| new QuicHttpStream(session->GetWeakPtr()));
|
| }
|
|
|
| +QuicErrorCode QuicStreamFactory::OnCryptoHandshakeCompleted(
|
| + QuicClientSession* session,
|
| + const QuicServerId& server_id,
|
| + int number_of_handshakes) {
|
| + DCHECK_LT(0, number_of_handshakes);
|
| + if (number_of_handshakes != number_of_lossy_handshakes_)
|
| + return QUIC_NO_ERROR;
|
| +
|
| + bool bad_packet_loss_rate =
|
| + (session->PacketLossRate() / 10) > packet_loss_threshold_;
|
| +
|
| + UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.HasBadPacketLossRate",
|
| + bad_packet_loss_rate);
|
| +
|
| + // It is not bad packet loss rate, enable 0-RTT.
|
| + if (!bad_packet_loss_rate) {
|
| + disable_zero_rtt_ = false;
|
| + return QUIC_NO_ERROR;
|
| + }
|
| +
|
| + HistogramBrokenAlternateProtocolLocation(
|
| + BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY);
|
| +
|
| + const HostPortPair& server = server_id.host_port_pair();
|
| + http_server_properties_->MarkAlternativeServiceRecentlyBroken(
|
| + AlternativeService(QUIC, server.host(), server.port()));
|
| + // TODO(rtenneti): Should we close the connection?
|
| + return QUIC_BAD_PACKET_LOSS_RATE;
|
| +}
|
| +
|
| void QuicStreamFactory::OnIdleSession(QuicClientSession* session) {
|
| }
|
|
|
|
|