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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 888943003: Add AlternateProtocol to broken_altproto_list_ and map_. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 10 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/http/http_server_properties_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl.cc
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index 0b6b9743626b0e0bcf273e4875d347118961e0ed..172e667df3f537bff7b87b7d4bf3fa3b319f7fbb 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -321,13 +321,14 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
it = alternate_protocol_map_.Put(server, alternate);
}
it->second.is_broken = true;
- int count = ++broken_alternate_protocol_map_[server];
+ const BrokenAlternateProtocolEntry entry(server, alternate.port,
+ alternate.protocol);
+ int count = ++broken_alternate_protocol_map_[entry];
base::TimeDelta delay =
base::TimeDelta::FromSeconds(kBrokenAlternateProtocolDelaySecs);
- BrokenAlternateProtocolEntry entry;
- entry.server = server;
- entry.when = base::TimeTicks::Now() + delay * (1 << (count - 1));
- broken_alternate_protocol_list_.push_back(entry);
+ base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << (count - 1));
+ broken_alternate_protocol_list_.push_back(
+ BrokenAlternateProtocolEntryWithTime(entry, when));
// Do not leave this host as canonical so that we don't infer the other
// hosts are also broken without testing them first.
@@ -342,12 +343,22 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
bool HttpServerPropertiesImpl::WasAlternateProtocolRecentlyBroken(
const HostPortPair& server) {
- return ContainsKey(broken_alternate_protocol_map_, server);
+ const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server);
+ if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ return false;
+ const BrokenAlternateProtocolEntry entry(server, alternate_protocol.port,
+ alternate_protocol.protocol);
+ return ContainsKey(broken_alternate_protocol_map_, entry);
}
void HttpServerPropertiesImpl::ConfirmAlternateProtocol(
const HostPortPair& server) {
- broken_alternate_protocol_map_.erase(server);
+ const AlternateProtocolInfo alternate_protocol = GetAlternateProtocol(server);
+ if (alternate_protocol.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL)
+ return;
+ const BrokenAlternateProtocolEntry entry(server, alternate_protocol.port,
+ alternate_protocol.protocol);
+ broken_alternate_protocol_map_.erase(entry);
}
void HttpServerPropertiesImpl::ClearAlternateProtocol(
@@ -501,12 +512,14 @@ void HttpServerPropertiesImpl::RemoveCanonicalHost(
void HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings() {
base::TimeTicks now = base::TimeTicks::Now();
while (!broken_alternate_protocol_list_.empty()) {
- BrokenAlternateProtocolEntry entry =
+ BrokenAlternateProtocolEntryWithTime entry_with_time =
broken_alternate_protocol_list_.front();
- if (now < entry.when) {
+ if (now < entry_with_time.when) {
break;
}
+ const BrokenAlternateProtocolEntry& entry =
+ entry_with_time.broken_alternate_protocol_entry;
ClearAlternateProtocol(entry.server);
broken_alternate_protocol_list_.pop_front();
}
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698