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

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: 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..5330ff48682500909233683f62c71bf3c542dc96 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,9 +194,11 @@ 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)
- const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(1);
+ // Randomize the timeout over a range from one to five minutes.
+ const TimeDelta kProxyRetryDelay =
+ TimeDelta::FromMilliseconds(base::RandInt(1 * 60 * 1000, 5 * 60 * 1000));
mmenke 2013/05/08 16:50:08 const Blah kBlah is generally only used for values
cbentzel 2013/05/08 16:57:18 proxy_retry_delay? I don't think the const buys u
mmenke 2013/05/08 16:58:58 The nice thing about the const is that it draws at
bengr 2013/05/08 17:23:11 Yeah, I thought about three ways of writing this:
#else
const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(5);
#endif
« 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