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

Unified Diff: chromeos/network/portal_detector/network_portal_detector_strategy.cc

Issue 383183002: Large timeouts between in-session portal detection attempts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix, rebase. Created 6 years, 5 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 | « chromeos/network/portal_detector/OWNERS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/portal_detector/network_portal_detector_strategy.cc
diff --git a/chromeos/network/portal_detector/network_portal_detector_strategy.cc b/chromeos/network/portal_detector/network_portal_detector_strategy.cc
index 3ff54e58d12ca4f500199e250ad1788a2dd498af..6a860c958bf6689cac82f7e9932bf792f234f020 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);
};
« no previous file with comments | « chromeos/network/portal_detector/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698