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

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: Re: first round of comments. 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..6d1aa47f5d7400176a480deba5e65daea288547e 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
@@ -307,12 +301,10 @@ 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(),
- ALTERNATE_PROTOCOL_BROKEN,
- 1);
- alternate_protocol_map_.Put(server, alternate);
+ LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
+ return;
Ryan Hamilton 2014/11/06 01:34:27 One more nit. Can you write this as: if (it == ..
Bence 2014/11/06 19:00:55 Excellent, thanks for catching this. Done.
}
int count = ++broken_alternate_protocol_map_[server];
base::TimeDelta delay =
« 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