| Index: net/quic/quic_stream_factory.cc
|
| diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
|
| index 678463ea70be5b59e5753ecb7022f4cd2012e4b6..2b4335a9739e8eb9c39772b9c5e298d3f9fc4b99 100644
|
| --- a/net/quic/quic_stream_factory.cc
|
| +++ b/net/quic/quic_stream_factory.cc
|
| @@ -603,10 +603,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_->GetAlternateProtocol(
|
| + 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));
|
| @@ -1041,9 +1049,20 @@ void QuicStreamFactory::ProcessGoingAwaySession(
|
| // session connected until the handshake has been confirmed.
|
| HistogramBrokenAlternateProtocolLocation(
|
| BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY);
|
| - AlternateProtocolInfo alternate =
|
| +
|
| + const AlternateProtocols alternate_protocols =
|
| http_server_properties_->GetAlternateProtocol(server);
|
| - DCHECK_EQ(QUIC, alternate.protocol);
|
| + 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
|
| @@ -1051,14 +1070,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
|
|
|