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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 2464263003: Limit exponential backoff for broken alternative services. (Closed)
Patch Set: 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..4a4139a0b97e325038bffbc1d4cc6e572c2a1d05 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 - 1) ~ 2 days.
const uint64_t kBrokenAlternativeProtocolDelaySecs = 300;
+const int kBrokenDelayMaxShift = 10;
} // namespace
@@ -472,7 +474,9 @@ void HttpServerPropertiesImpl::MarkAlternativeServiceBroken(
LOG(DFATAL) << "Trying to mark unknown alternate protocol broken.";
return;
}
- int count = ++recently_broken_alternative_services_[alternative_service];
+ int& count = recently_broken_alternative_services_[alternative_service];
+ if (count < kBrokenDelayMaxShift)
+ ++count;
Zhongyi Shi 2016/11/02 20:17:58 What if the count >= kBrokenDelayMaxShift? I think
Bence 2016/11/07 20:17:24 Done.
base::TimeDelta delay =
base::TimeDelta::FromSeconds(kBrokenAlternativeProtocolDelaySecs);
base::TimeTicks when = base::TimeTicks::Now() + delay * (1 << (count - 1));
« 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