diff options
author | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 22:03:16 +0000 |
---|---|---|
committer | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-16 22:03:16 +0000 |
commit | c3eb032875146ba53849bc9fb436c8143bfba63e (patch) | |
tree | 496b159e47859c1225f35e5f24ab4f7f84879ee0 | |
parent | 66000edf797059d80c6f6f60e9ddd0203dad2524 (diff) | |
download | chromium_src-c3eb032875146ba53849bc9fb436c8143bfba63e.zip chromium_src-c3eb032875146ba53849bc9fb436c8143bfba63e.tar.gz chromium_src-c3eb032875146ba53849bc9fb436c8143bfba63e.tar.bz2 |
Large timeouts between in-session portal detection attempts.
https://codereview.chromium.org/385553002/ uses BackoffEntry, but it requires a lot of changes, so it probably won't be merged to M37. I suggest to merge this small fix.
BUG=377725
TEST=manual
Review URL: https://codereview.chromium.org/383183002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283536 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chromeos/network/portal_detector/OWNERS | 1 | ||||
-rw-r--r-- | chromeos/network/portal_detector/network_portal_detector_strategy.cc | 24 |
2 files changed, 21 insertions, 4 deletions
diff --git a/chromeos/network/portal_detector/OWNERS b/chromeos/network/portal_detector/OWNERS new file mode 100644 index 0000000..7938295 --- /dev/null +++ b/chromeos/network/portal_detector/OWNERS @@ -0,0 +1 @@ +ygorshenin@chromium.org diff --git a/chromeos/network/portal_detector/network_portal_detector_strategy.cc b/chromeos/network/portal_detector/network_portal_detector_strategy.cc index 3ff54e5..6a860c9 100644 --- a/chromeos/network/portal_detector/network_portal_detector_strategy.cc +++ b/chromeos/network/portal_detector/network_portal_detector_strategy.cc @@ -75,10 +75,14 @@ class ErrorScreenStrategy : public PortalDetectorStrategy { class SessionStrategy : public PortalDetectorStrategy { public: static const int kFastDelayBetweenAttemptsSec = 1; - static const int kMaxFastAttempts = 3; static const int kFastAttemptTimeoutSec = 3; + static const int kMaxFastAttempts = 3; - static const int kSlowDelayBetweenAttemptsSec = 10; + static const int kNormalDelayBetweenAttemptsSec = 10; + static const int kNormalAttemptTimeoutSec = 5; + static const int kMaxNormalAttempts = 3; + + static const int kSlowDelayBetweenAttemptsSec = 2 * 60; static const int kSlowAttemptTimeoutSec = 5; SessionStrategy() {} @@ -90,22 +94,34 @@ class SessionStrategy : public PortalDetectorStrategy { virtual bool CanPerformAttemptAfterDetectionImpl() OVERRIDE { return true; } virtual base::TimeDelta GetDelayTillNextAttemptImpl() OVERRIDE { int delay; - if (delegate_->AttemptCount() < kMaxFastAttempts) + if (IsFastAttempt()) delay = kFastDelayBetweenAttemptsSec; + else if (IsNormalAttempt()) + delay = kNormalDelayBetweenAttemptsSec; else delay = kSlowDelayBetweenAttemptsSec; return AdjustDelay(base::TimeDelta::FromSeconds(delay)); } virtual base::TimeDelta GetNextAttemptTimeoutImpl() OVERRIDE { int timeout; - if (delegate_->AttemptCount() < kMaxFastAttempts) + if (IsFastAttempt()) timeout = kFastAttemptTimeoutSec; + else if (IsNormalAttempt()) + timeout = kNormalAttemptTimeoutSec; else timeout = kSlowAttemptTimeoutSec; return base::TimeDelta::FromSeconds(timeout); } private: + bool IsFastAttempt() { + return delegate_->AttemptCount() < kMaxFastAttempts; + } + + bool IsNormalAttempt() { + return delegate_->AttemptCount() < kMaxFastAttempts + kMaxNormalAttempts; + } + DISALLOW_COPY_AND_ASSIGN(SessionStrategy); }; |