Index: net/quic/quic_stream_factory.cc |
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc |
index a36449099a8a332654519062fed8f4f452f0cfc8..b654ef07bad4b849d8468f58e2f32a7a1cbcea6f 100644 |
--- a/net/quic/quic_stream_factory.cc |
+++ b/net/quic/quic_stream_factory.cc |
@@ -1319,21 +1319,36 @@ |
if (!session_was_active) |
return; |
+ const HostPortPair& server = server_id.host_port_pair(); |
+ // Don't try to change the alternate-protocol state, if the |
+ // alternate-protocol state is unknown. |
+ const AlternateProtocolInfo alternate = |
+ http_server_properties_->GetAlternateProtocol(server); |
+ if (alternate.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
+ return; |
+ |
// TODO(rch): In the special case where the session has received no |
// packets from the peer, we should consider blacklisting this |
// differently so that we still race TCP but we don't consider the |
// session connected until the handshake has been confirmed. |
HistogramBrokenAlternateProtocolLocation( |
BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY); |
+ DCHECK_EQ(QUIC, alternate.protocol); |
// Since the session was active, there's no longer an |
- // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
- // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
- // it as recently broken, which means that 0-RTT will be disabled but we'll |
- // still race. |
- const HostPortPair& server = server_id.host_port_pair(); |
- http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
- AlternativeService(QUIC, server.host(), server.port())); |
+ // HttpStreamFactoryImpl::Job running which can mark it broken, unless the |
+ // TCP job also fails. So to avoid not using QUIC when we otherwise could, |
+ // we mark it as broken, and then immediately re-enable it. This leaves |
+ // QUIC as "recently broken" which means that 0-RTT will be disabled but |
+ // we'll still race. |
+ http_server_properties_->SetBrokenAlternateProtocol(server); |
+ http_server_properties_->ClearAlternateProtocol(server); |
+ http_server_properties_->SetAlternateProtocol( |
+ server, alternate.port, alternate.protocol, 1); |
+ DCHECK_EQ(QUIC, |
+ http_server_properties_->GetAlternateProtocol(server).protocol); |
+ DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
+ server)); |
} |
} // namespace net |