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

Unified Diff: net/proxy/proxy_list.cc

Issue 14864016: Randomize proxy timeout on Android over a range. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed to proxy_retry_delay Created 7 years, 7 months 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/proxy/proxy_list.cc
diff --git a/net/proxy/proxy_list.cc b/net/proxy/proxy_list.cc
index a3ab02c392a638643fd0b9a06a72cbb77a5bcf69..723e7188e2af510b3371cd043f185e930f15ba43 100644
--- a/net/proxy/proxy_list.cc
+++ b/net/proxy/proxy_list.cc
@@ -6,6 +6,7 @@
#include "base/callback.h"
#include "base/logging.h"
+#include "base/rand_util.h"
#include "base/strings/string_tokenizer.h"
#include "base/time.h"
#include "base/values.h"
@@ -193,11 +194,13 @@ bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info,
void ProxyList::UpdateRetryInfoOnFallback(
ProxyRetryInfoMap* proxy_retry_info, const BoundNetLog& net_log) const {
- // Number of minutes to wait before retrying a bad proxy server.
+ // Time to wait before retrying a bad proxy server.
#if defined(OS_ANDROID)
Matt Welsh 2013/05/10 18:28:25 Shouldn't this also be the case for iOS?
- const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(1);
+ // Randomize the timeout over a range from one to five minutes.
+ const TimeDelta proxy_retry_delay =
+ TimeDelta::FromMilliseconds(base::RandInt(1 * 60 * 1000, 5 * 60 * 1000));
#else
- const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(5);
+ const TimeDelta proxy_retry_delay = TimeDelta::FromMinutes(5);
#endif
if (proxies_.empty()) {
@@ -215,7 +218,7 @@ void ProxyList::UpdateRetryInfoOnFallback(
iter->second.bad_until = TimeTicks::Now() + iter->second.current_delay;
} else {
ProxyRetryInfo retry_info;
- retry_info.current_delay = kProxyRetryDelay;
+ retry_info.current_delay = proxy_retry_delay;
retry_info.bad_until = TimeTicks().Now() + retry_info.current_delay;
(*proxy_retry_info)[key] = retry_info;
}
« 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