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

Unified Diff: net/base/backoff_entry.cc

Issue 6932013: Fix logic for handling reports of malformed bodies. To end up counting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | net/url_request/url_request_throttler_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/backoff_entry.cc
diff --git a/net/base/backoff_entry.cc b/net/base/backoff_entry.cc
index 44bae52731b2cd998295a8c37d0b22631975aa59..092be183ab459901ab6c8b0b2e706f2d4125a745 100644
--- a/net/base/backoff_entry.cc
+++ b/net/base/backoff_entry.cc
@@ -29,22 +29,12 @@ BackoffEntry::~BackoffEntry() {
void BackoffEntry::InformOfRequest(bool succeeded) {
if (!succeeded) {
- failure_count_++;
- exponential_backoff_release_time_ = CalculateReleaseTime();
+ ++failure_count_;
} else {
- failure_count_ = 0;
-
- // The reason why we are not just cutting the release time to GetTimeNow()
- // is on the one hand, it would unset a release time set by
- // SetCustomReleaseTime and on the other we would like to push every
- // request up to our "horizon" when dealing with multiple in-flight
- // requests. Ex: If we send three requests and we receive 2 failures and
- // 1 success. The success that follows those failures will not reset the
- // release time, further requests will then need to wait the delay caused
- // by the 2 failures.
- exponential_backoff_release_time_ = std::max(
- GetTimeNow(), exponential_backoff_release_time_);
+ failure_count_ = std::max(0, --failure_count_);
}
+
+ exponential_backoff_release_time_ = CalculateReleaseTime();
sanjeevr 2011/05/04 18:51:50 I don't know the code well enough to tell if calli
Jói 2011/05/04 20:04:29 Nope, it's a small bug to call it in the success c
}
bool BackoffEntry::ShouldRejectRequest() const {
@@ -110,7 +100,9 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const {
static_cast<int64>(policy_->maximum_backoff_ms));
// Never reduce previously set release horizon, e.g. due to Retry-After
- // header.
+ // header. To clarify, the delay we are adding may have been reduced (if
+ // the failure count was decreased from its previous value) but the absolute
+ // time of the release horizon should not be moved forward.
return std::max(GetTimeNow() + base::TimeDelta::FromMilliseconds(delay_int),
exponential_backoff_release_time_);
}
« no previous file with comments | « no previous file | net/url_request/url_request_throttler_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698