Commit f71da630 authored by bnc's avatar bnc Committed by Commit bot

Lazy RemoveCanonicalHost().

Call RemoveCanonicalHost() when the alternative service is found to be broken
upon lookup, instead of when the alternative service is first marked broken.
This will allow SetBrokenAlternateProtocol to take an alternative service
instead of an origin.

BUG=392576

Review URL: https://codereview.chromium.org/1014303002

Cr-Commit-Position: refs/heads/master@{#321466}
parent a9d12ce1
...@@ -328,10 +328,6 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol( ...@@ -328,10 +328,6 @@ void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
return; return;
} }
// Do not leave this host as canonical so that we don't infer the other
// hosts are also broken without testing them first.
RemoveCanonicalHost(origin);
// If this is the only entry in the list, schedule an expiration task. // If this is the only entry in the list, schedule an expiration task.
// Otherwise it will be rescheduled automatically when the pending task runs. // Otherwise it will be rescheduled automatically when the pending task runs.
if (broken_alternative_services_.size() == 1) { if (broken_alternative_services_.size() == 1) {
...@@ -496,9 +492,23 @@ HttpServerPropertiesImpl::GetAlternateProtocolIterator( ...@@ -496,9 +492,23 @@ HttpServerPropertiesImpl::GetAlternateProtocolIterator(
return it; return it;
CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server); CanonicalHostMap::const_iterator canonical = GetCanonicalHost(server);
if (canonical != canonical_host_to_origin_map_.end()) if (canonical == canonical_host_to_origin_map_.end()) {
return alternate_protocol_map_.Get(canonical->second); return alternate_protocol_map_.end();
}
const HostPortPair canonical_host_port = canonical->second;
it = alternate_protocol_map_.Get(canonical_host_port);
if (it == alternate_protocol_map_.end()) {
return alternate_protocol_map_.end();
}
const AlternativeService alternative_service(
it->second.protocol, canonical_host_port.host(), it->second.port);
if (!IsAlternativeServiceBroken(alternative_service)) {
return it;
}
RemoveCanonicalHost(canonical_host_port);
return alternate_protocol_map_.end(); return alternate_protocol_map_.end();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment