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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 701163002: Introduce AlternateProtocolInfo.is_broken. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 6 years, 1 month 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.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | 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 103d0e1eaa36dad0eb2ab29c6f257bf2ec653ccd..65ecd110ab9e221008e6efa3587ea0afb5c84ec9 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -49,13 +49,12 @@ void HttpServerPropertiesImpl::InitializeSpdyServers(
void HttpServerPropertiesImpl::InitializeAlternateProtocolServers(
AlternateProtocolMap* alternate_protocol_map) {
- // Keep all the ALTERNATE_PROTOCOL_BROKEN ones since those don't
- // get persisted.
+ // Keep all the broken ones since those don't get persisted.
for (AlternateProtocolMap::iterator it = alternate_protocol_map_.begin();
it != alternate_protocol_map_.end();) {
AlternateProtocolMap::iterator old_it = it;
++it;
- if (old_it->second.protocol != ALTERNATE_PROTOCOL_BROKEN) {
+ if (!old_it->second.is_broken) {
alternate_protocol_map_.Erase(old_it);
}
}
@@ -251,10 +250,6 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
uint16 alternate_port,
AlternateProtocol alternate_protocol,
double alternate_probability) {
- if (alternate_protocol == ALTERNATE_PROTOCOL_BROKEN) {
- LOG(DFATAL) << "Call SetBrokenAlternateProtocol() instead.";
- return;
- }
AlternateProtocolInfo alternate(alternate_port,
alternate_protocol,
@@ -263,13 +258,12 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
const AlternateProtocolInfo existing_alternate =
GetAlternateProtocol(server);
- if (existing_alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) {
+ if (existing_alternate.is_broken) {
DVLOG(1) << "Ignore alternate protocol since it's known to be broken.";
return;
}
- if (alternate_protocol != ALTERNATE_PROTOCOL_BROKEN &&
- !existing_alternate.Equals(alternate)) {
+ if (!existing_alternate.Equals(alternate)) {
LOG(WARNING) << "Changing the alternate protocol for: "
<< server.ToString()
<< " from [Port: " << existing_alternate.port
@@ -306,14 +300,11 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
void HttpServerPropertiesImpl::SetBrokenAlternateProtocol(
const HostPortPair& server) {
AlternateProtocolMap::iterator it = alternate_protocol_map_.Get(server);
- if (it != alternate_protocol_map_.end()) {
- it->second.protocol = ALTERNATE_PROTOCOL_BROKEN;
- } else {
- AlternateProtocolInfo alternate(server.port(),
- ALTERNATE_PROTOCOL_BROKEN,
- 1);
- alternate_protocol_map_.Put(server, alternate);
+ if (it == alternate_protocol_map_.end()) {
+ LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
+ return;
}
+ it->second.is_broken = true;
int count = ++broken_alternate_protocol_map_[server];
base::TimeDelta delay =
base::TimeDelta::FromSeconds(kBrokenAlternateProtocolDelaySecs);
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698