summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 22:48:10 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 22:48:10 +0000
commit6dc408a40e64ece68e37528ddb2fc01035e83807 (patch)
treebe7fc43034d949501013cb7ac070203395ed336e /net/url_request
parent5b3e6d6cce783d9cb9b878f51d26235b7d9606b1 (diff)
downloadchromium_src-6dc408a40e64ece68e37528ddb2fc01035e83807.zip
chromium_src-6dc408a40e64ece68e37528ddb2fc01035e83807.tar.gz
chromium_src-6dc408a40e64ece68e37528ddb2fc01035e83807.tar.bz2
BackoffEntry: Add the option to use a delay between requests
before backoff starts due to failures, for use with captive portal code. R=joi@chroimium.org BUG=87100, 115487 Review URL: http://codereview.chromium.org/10173005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_throttler_entry.cc11
-rw-r--r--net/url_request/url_request_throttler_entry.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index 3154f9c..ece2b8b 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -39,7 +39,7 @@ const int URLRequestThrottlerEntry::kDefaultMaxSendThreshold = 20;
// avoid false positives. It should help avoid back-off from kicking in e.g.
// on flaky connections.
const int URLRequestThrottlerEntry::kDefaultNumErrorsToIgnore = 2;
-const int URLRequestThrottlerEntry::kDefaultInitialBackoffMs = 700;
+const int URLRequestThrottlerEntry::kDefaultInitialDelayMs = 700;
const double URLRequestThrottlerEntry::kDefaultMultiplyFactor = 1.4;
const double URLRequestThrottlerEntry::kDefaultJitterFactor = 0.4;
const int URLRequestThrottlerEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
@@ -116,12 +116,13 @@ URLRequestThrottlerEntry::URLRequestThrottlerEntry(
DCHECK(manager_);
Initialize();
- backoff_policy_.initial_backoff_ms = initial_backoff_ms;
+ backoff_policy_.initial_delay_ms = initial_backoff_ms;
backoff_policy_.multiply_factor = multiply_factor;
backoff_policy_.jitter_factor = jitter_factor;
backoff_policy_.maximum_backoff_ms = maximum_backoff_ms;
backoff_policy_.entry_lifetime_ms = -1;
backoff_policy_.num_errors_to_ignore = 0;
+ backoff_policy_.always_use_initial_delay = false;
}
bool URLRequestThrottlerEntry::IsEntryOutdated() const {
@@ -163,8 +164,7 @@ bool URLRequestThrottlerEntry::ShouldRejectRequest(int load_flags) const {
GetBackoffEntry()->ShouldRejectRequest()) {
int num_failures = GetBackoffEntry()->failure_count();
int release_after_ms =
- (GetBackoffEntry()->GetReleaseTime() - base::TimeTicks::Now())
- .InMilliseconds();
+ GetBackoffEntry()->GetTimeUntilRelease().InMilliseconds();
net_log_.AddEvent(
NetLog::TYPE_THROTTLING_REJECTED_REQUEST,
@@ -271,11 +271,12 @@ URLRequestThrottlerEntry::~URLRequestThrottlerEntry() {
void URLRequestThrottlerEntry::Initialize() {
sliding_window_release_time_ = base::TimeTicks::Now();
backoff_policy_.num_errors_to_ignore = kDefaultNumErrorsToIgnore;
- backoff_policy_.initial_backoff_ms = kDefaultInitialBackoffMs;
+ backoff_policy_.initial_delay_ms = kDefaultInitialDelayMs;
backoff_policy_.multiply_factor = kDefaultMultiplyFactor;
backoff_policy_.jitter_factor = kDefaultJitterFactor;
backoff_policy_.maximum_backoff_ms = kDefaultMaximumBackoffMs;
backoff_policy_.entry_lifetime_ms = kDefaultEntryLifetimeMs;
+ backoff_policy_.always_use_initial_delay = false;
// We pretend we just had a successful response so that we have a
// starting point to our tracking. This is called from the
diff --git a/net/url_request/url_request_throttler_entry.h b/net/url_request/url_request_throttler_entry.h
index 5c73c85..3ebd5c9 100644
--- a/net/url_request/url_request_throttler_entry.h
+++ b/net/url_request/url_request_throttler_entry.h
@@ -43,7 +43,7 @@ class NET_EXPORT URLRequestThrottlerEntry
static const int kDefaultNumErrorsToIgnore;
// Initial delay for exponential back-off.
- static const int kDefaultInitialBackoffMs;
+ static const int kDefaultInitialDelayMs;
// Factor by which the waiting time will be multiplied.
static const double kDefaultMultiplyFactor;