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

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: Lint. 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
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..6505d03674726a5e9a473d168141d5486e7c0467 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;
- }
Ryan Hamilton 2014/11/05 17:05:20 NICE! I've always hated this DFATAL.
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
@@ -307,11 +301,12 @@ 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;
+ it->second.is_broken = true;
} else {
AlternateProtocolInfo alternate(server.port(),
Ryan Hamilton 2014/11/05 17:05:20 consider adding a DLOG(DFATAL) here since I don't
Bence 2014/11/06 00:26:00 Done.
- ALTERNATE_PROTOCOL_BROKEN,
- 1);
+ UNINITIALIZED_ALTERNATE_PROTOCOL,
+ 1,
+ true);
alternate_protocol_map_.Put(server, alternate);
}
int count = ++broken_alternate_protocol_map_[server];

Powered by Google App Engine
This is Rietveld 408576698