Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: net/quic/quic_stream_factory.cc

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Custom entries for broken_alternate_protocol_list_ and map_. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_stream_factory.cc
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index da2f56c9e75e89aa8811928c9d31bb12899bbee3..c3f1c0607cc0bdbd3710c33a69587d3207725908 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -646,20 +646,24 @@ int QuicStreamFactory::Create(const HostPortPair& host_port_pair,
return ERR_IO_PENDING;
}
+ bool was_alternate_protocol_recently_broken = false;
+ AlternateProtocolInfo alternate_protocol;
+ if (http_server_properties_) {
+ alternate_protocol =
+ http_server_properties_->GetAlternateProtocol(host_port_pair);
+ if (alternate_protocol.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) {
+ was_alternate_protocol_recently_broken =
+ http_server_properties_->WasAlternateProtocolRecentlyBroken(
+ host_port_pair, alternate_protocol);
+ }
+ }
+
QuicServerInfo* quic_server_info = nullptr;
if (quic_server_info_factory_) {
- bool load_from_disk_cache = true;
- if (http_server_properties_) {
- const AlternateProtocolMap& alternate_protocol_map =
- 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.
- load_from_disk_cache = false;
- }
- }
+ // 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.
+ const bool load_from_disk_cache =
+ !http_server_properties_ || alternate_protocol.protocol == QUIC;
if (load_from_disk_cache) {
QuicCryptoClientConfig::CachedState* cached =
crypto_config_.LookupOrCreate(server_id);
@@ -674,10 +678,6 @@ 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());
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));
@@ -1186,10 +1186,13 @@ 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 (const std::pair<const HostPortPair, AlternateProtocols>& key_value :
+ http_server_properties_->alternate_protocol_map()) {
+ for (const AlternateProtocolInfo& alternate_protocol :
+ key_value.second) {
+ if (alternate_protocol.protocol == QUIC) {
+ quic_supported_servers_at_startup_.insert(key_value.first);
+ }
}
}
}
@@ -1249,7 +1252,9 @@ void QuicStreamFactory::ProcessGoingAwaySession(
const HostPortPair& server = server_id.host_port_pair();
// Don't try to change the alternate-protocol state, if the
// alternate-protocol state is unknown.
- if (!http_server_properties_->HasAlternateProtocol(server))
+ 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
@@ -1258,8 +1263,7 @@ 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);
// Since the session was active, there's no longer an
@@ -1268,14 +1272,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.0);
DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
- server));
+ server, alternate));
}
} // namespace net
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698