| Index: net/quic/quic_stream_factory.cc
|
| diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
|
| index fed8956aa19ae6cb1961686ee65484863e16de1d..54cfbb2a15cc93b6c94148303f34f279efc4ff40 100644
|
| --- a/net/quic/quic_stream_factory.cc
|
| +++ b/net/quic/quic_stream_factory.cc
|
| @@ -657,10 +657,22 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
|
| http_server_properties_->alternate_protocol_map();
|
| AlternateProtocolMap::const_iterator it =
|
| alternate_protocol_map.Peek(server_id.host_port_pair());
|
| - if (it == alternate_protocol_map.end() || it->second.protocol != QUIC) {
|
| - // If there is no entry for QUIC, consider that as a new server and
|
| - // don't wait for Cache thread to load the data for that server.
|
| + // If there is no entry for QUIC, consider that as a new server and
|
| + // don't wait for Cache thread to load the data for that server.
|
| + if (it == alternate_protocol_map.end()) {
|
| load_from_disk_cache = false;
|
| + } else {
|
| + AlternateProtocols alternate_protocols = it->second;
|
| + AlternateProtocols::iterator alternate;
|
| + for (alternate = alternate_protocols.begin();
|
| + alternate != alternate_protocols.end(); ++alternate) {
|
| + if (alternate->protocol == QUIC) {
|
| + break;
|
| + }
|
| + }
|
| + if (alternate == alternate_protocols.end()) {
|
| + load_from_disk_cache = false;
|
| + }
|
| }
|
| }
|
| if (load_from_disk_cache) {
|
| @@ -677,10 +689,18 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
|
| if (!task_runner_)
|
| task_runner_ = base::MessageLoop::current()->message_loop_proxy().get();
|
|
|
| - bool was_alternate_protocol_recently_broken =
|
| - http_server_properties_ &&
|
| - http_server_properties_->WasAlternateProtocolRecentlyBroken(
|
| - server_id.host_port_pair());
|
| + bool was_alternate_protocol_recently_broken = false;
|
| + if (http_server_properties_ &&
|
| + http_server_properties_->HasAlternateProtocol(
|
| + server_id.host_port_pair())) {
|
| + AlternateProtocols alternate_protocols =
|
| + http_server_properties_->GetAlternateProtocols(
|
| + server_id.host_port_pair());
|
| + AlternateProtocolInfo alternate_protocol = alternate_protocols[0];
|
| + was_alternate_protocol_recently_broken =
|
| + http_server_properties_->WasAlternateProtocolRecentlyBroken(
|
| + server_id.host_port_pair(), alternate_protocol);
|
| + }
|
| scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_pair, is_https,
|
| was_alternate_protocol_recently_broken,
|
| privacy_mode, method, quic_server_info, net_log));
|
| @@ -1146,10 +1166,11 @@ void QuicStreamFactory::InitializeCachedStateInCryptoConfig(
|
|
|
| if (http_server_properties_) {
|
| if (quic_supported_servers_at_startup_.empty()) {
|
| - for (const std::pair<const net::HostPortPair, net::AlternateProtocolInfo>&
|
| - key_value : http_server_properties_->alternate_protocol_map()) {
|
| - if (key_value.second.protocol == QUIC) {
|
| - quic_supported_servers_at_startup_.insert(key_value.first);
|
| + for (auto key_value : http_server_properties_->alternate_protocol_map()) {
|
| + for (auto alternate_protocol : key_value.second) {
|
| + if (alternate_protocol.protocol == QUIC) {
|
| + quic_supported_servers_at_startup_.insert(key_value.first);
|
| + }
|
| }
|
| }
|
| }
|
| @@ -1218,9 +1239,19 @@ void QuicStreamFactory::ProcessGoingAwaySession(
|
| // session connected until the handshake has been confirmed.
|
| HistogramBrokenAlternateProtocolLocation(
|
| BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY);
|
| - AlternateProtocolInfo alternate =
|
| - http_server_properties_->GetAlternateProtocol(server);
|
| - DCHECK_EQ(QUIC, alternate.protocol);
|
| +
|
| + const AlternateProtocols alternate_protocols =
|
| + http_server_properties_->GetAlternateProtocols(server);
|
| + AlternateProtocols::const_iterator alternate;
|
| + for (alternate = alternate_protocols.begin();
|
| + alternate != alternate_protocols.end(); ++alternate) {
|
| + if (alternate->protocol == QUIC) {
|
| + break;
|
| + }
|
| + }
|
| + // Do not use DCHECK_NE as operator<<(ostream, iterator) is not defined.
|
| + DCHECK(alternate != alternate_protocols.end())
|
| + << "No QUIC alternate protocol found";
|
|
|
| // Since the session was active, there's no longer an
|
| // HttpStreamFactoryImpl::Job running which can mark it broken, unless the
|
| @@ -1228,14 +1259,12 @@ void QuicStreamFactory::ProcessGoingAwaySession(
|
| // 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);
|
| + http_server_properties_->SetBrokenAlternateProtocol(server, *alternate);
|
| + http_server_properties_->RemoveAlternateProtocol(server, *alternate);
|
| + http_server_properties_->AddAlternateProtocol(server, alternate->port,
|
| + alternate->protocol, 1);
|
| DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
|
| - server));
|
| + server, *alternate));
|
| }
|
|
|
| } // namespace net
|
|
|