diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 18:51:53 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 18:51:53 +0000 |
commit | 82c71ba49a999ffa2b9c57aefc664dfd9bbe8186 (patch) | |
tree | a119d96375aa37d2609cfc911ed5a9c84c594f4b /net/base/backoff_entry.h | |
parent | 4d768302d3e793d3b717bedea907b6038e391bff (diff) | |
download | chromium_src-82c71ba49a999ffa2b9c57aefc664dfd9bbe8186.zip chromium_src-82c71ba49a999ffa2b9c57aefc664dfd9bbe8186.tar.gz chromium_src-82c71ba49a999ffa2b9c57aefc664dfd9bbe8186.tar.bz2 |
Anti-DDoS enhancements: Log to net log, UMA stats, improved policy.
Count only certain error codes as failures. Don't count malformed body
for codes already counted failures. Start with fresh entry when
outdated, which makes policy slightly less aggressive.
Add registration/unregistration to NetworkChangeNotifier, and reset
throttling state on network changes, to avoid degenerate corner cases.
Add UMA stats for throttling, and unit tests for them.
Add hash-location-only URL to unit test.
Enable testing of AJAX behavior via backoff_server.
BUG=83775
TEST=net_unittests
Review URL: http://codereview.chromium.org/6966038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/backoff_entry.h')
-rw-r--r-- | net/base/backoff_entry.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/base/backoff_entry.h b/net/base/backoff_entry.h index 1a7d2dc..a3bca91 100644 --- a/net/base/backoff_entry.h +++ b/net/base/backoff_entry.h @@ -69,10 +69,15 @@ class NET_TEST BackoffEntry : NON_EXPORTED_BASE(public base::NonThreadSafe) { // had for Policy::entry_lifetime_ms_. bool CanDiscard() const; + // Resets this entry to a fresh (as if just constructed) state. + void Reset(); + + // Returns the failure count for this entry. + int failure_count() const { return failure_count_; } + protected: // Equivalent to TimeTicks::Now(), virtual so unit tests can override. - // TODO(joi): Switch to constructor-time dependency injection? - virtual base::TimeTicks GetTimeNow() const; + virtual base::TimeTicks ImplGetTimeNow() const; private: // Calculates when requests should again be allowed through. |