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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 2464263003: Limit exponential backoff for broken alternative services. (Closed)
Patch Set: Re: #7. Created 4 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 | « no previous file | 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 f0489c8698671be4b62107d75724afec2fc16a8d..ceffabb2c457c82c861f1265a3ca3fff5c4bcc7d 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -23,7 +23,9 @@ namespace net {
namespace {
+// kBrokenAlternativeProtocolDelaySecs << kBrokenDelayMaxShift ~ 2 days.
Ryan Hamilton 2016/11/03 16:16:22 nit: I'm not sure what this comment means? Perhaps
Bence 2016/11/07 20:17:24 Done.
const uint64_t kBrokenAlternativeProtocolDelaySecs = 300;
+const int kBrokenDelayMaxShift = 9;
} // namespace
@@ -472,10 +474,13 @@ void HttpServerPropertiesImpl::MarkAlternativeServiceBroken(
LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
return;
}
- int count = ++recently_broken_alternative_services_[alternative_service];
+ ++recently_broken_alternative_services_[alternative_service];
+ int shift = recently_broken_alternative_services_[alternative_service] - 1;
Zhongyi Shi 2016/11/03 15:59:37 typo here? Since you're directly retrieving shift
Bence 2016/11/07 20:17:24 Indeed prefix increment returns new value. And |c
+ if (shift > kBrokenDelayMaxShift)
+ shift = kBrokenDelayMaxShift;
base::TimeDelta delay =
base::TimeDelta::FromSeconds(kBrokenAlternativeProtocolDelaySecs);
- base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << (count - 1));
+ base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << shift);
auto result = broken_alternative_services_.insert(
std::make_pair(alternative_service, when));
// Return if alternative service is already in expiration queue.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698