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

Unified Diff: net/http/http_server_properties_impl.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 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 | « net/filter/gzip_source_stream_unittest.cc ('k') | net/nqe/network_quality_estimator.h » ('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 f0489c8698671be4b62107d75724afec2fc16a8d..79c6e08dca802ef97d58f144b24b56e729df92c1 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -23,7 +23,11 @@ namespace net {
namespace {
+// Initial delay for broken alternative services.
const uint64_t kBrokenAlternativeProtocolDelaySecs = 300;
+// Subsequent failures result in exponential (base 2) backoff.
+// Limit binary shift to limit delay to approximately 2 days.
+const int kBrokenDelayMaxShift = 9;
} // namespace
@@ -472,10 +476,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;
+ 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 | « net/filter/gzip_source_stream_unittest.cc ('k') | net/nqe/network_quality_estimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698