summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 11:58:57 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 11:58:57 +0000
commit236ead5e35b93ff9c1e48d61d5545124af9fe83b (patch)
tree70c62e127698eaa4a37aa830b1a6a63a3b10b2f6 /jingle
parent2ac06ded4372e8a8f79f97b74bad922098645af5 (diff)
downloadchromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.zip
chromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.tar.gz
chromium_src-236ead5e35b93ff9c1e48d61d5545124af9fe83b.tar.bz2
Revert 144382 - [Sync] Make Login class listen to connection and DNS changes
Reason: http://build.chromium.org/p/chromium/builders/Mac10.6%20Sync/builds/19046 Make sync_listen_notifications listen for network changes. Add a scoped NSAutoreleasePool to sync_listen_notifications. Relax DEPS for sync/tools a bit. BUG=106034 TEST= Review URL: https://chromiumcodereview.appspot.com/10675012 TBR=akalin@chromium.org Review URL: https://chromiumcodereview.appspot.com/10690007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144439 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/notifier/communicator/login.cc29
-rw-r--r--jingle/notifier/communicator/login.h14
2 files changed, 6 insertions, 37 deletions
diff --git a/jingle/notifier/communicator/login.cc b/jingle/notifier/communicator/login.cc
index 5f6a2861..db4813b 100644
--- a/jingle/notifier/communicator/login.cc
+++ b/jingle/notifier/communicator/login.cc
@@ -43,19 +43,15 @@ Login::Login(Delegate* delegate,
try_ssltcp_first,
auth_mechanism) {
net::NetworkChangeNotifier::AddIPAddressObserver(this);
- net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
- net::NetworkChangeNotifier::AddDNSObserver(this);
ResetReconnectState();
}
Login::~Login() {
- net::NetworkChangeNotifier::RemoveDNSObserver(this);
- net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
}
void Login::StartConnection() {
- DVLOG(1) << "Starting connection...";
+ VLOG(1) << "Starting connection...";
single_attempt_.reset(new SingleLoginAttempt(login_settings_, this));
}
@@ -91,22 +87,7 @@ void Login::OnSettingsExhausted() {
}
void Login::OnIPAddressChanged() {
- DVLOG(1) << "Detected IP address change";
- OnNetworkEvent();
-}
-
-void Login::OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) {
- DVLOG(1) << "Detected connection type change";
- OnNetworkEvent();
-}
-
-void Login::OnDNSChanged(unsigned detail) {
- DVLOG(1) << "Detected DNS change";
- OnNetworkEvent();
-}
-
-void Login::OnNetworkEvent() {
+ VLOG(1) << "Detected IP address change";
// Reconnect in 1 to 9 seconds (vary the time a little to try to
// avoid spikey behavior on network hiccups).
reconnect_interval_ = base::TimeDelta::FromSeconds(base::RandInt(1, 9));
@@ -124,8 +105,8 @@ void Login::TryReconnect() {
DCHECK_GT(reconnect_interval_.InSeconds(), 0);
single_attempt_.reset();
reconnect_timer_.Stop();
- DVLOG(1) << "Reconnecting in "
- << reconnect_interval_.InSeconds() << " seconds";
+ VLOG(1) << "Reconnecting in "
+ << reconnect_interval_.InSeconds() << " seconds";
reconnect_timer_.Start(
FROM_HERE, reconnect_interval_, this, &Login::DoReconnect);
}
@@ -137,7 +118,7 @@ void Login::DoReconnect() {
reconnect_interval_ *= 2;
if (reconnect_interval_ > kMaxReconnectInterval)
reconnect_interval_ = kMaxReconnectInterval;
- DVLOG(1) << "Reconnecting...";
+ VLOG(1) << "Reconnecting...";
StartConnection();
}
diff --git a/jingle/notifier/communicator/login.h b/jingle/notifier/communicator/login.h
index 7acde11..29be403 100644
--- a/jingle/notifier/communicator/login.h
+++ b/jingle/notifier/communicator/login.h
@@ -36,11 +36,7 @@ class LoginSettings;
// Does the login, keeps it alive (with refreshing cookies and
// reattempting login when disconnected), and figures out what actions
// to take on the various errors that may occur.
-//
-// TODO(akalin): Make this observe proxy config changes also.
class Login : public net::NetworkChangeNotifier::IPAddressObserver,
- public net::NetworkChangeNotifier::ConnectionTypeObserver,
- public net::NetworkChangeNotifier::DNSObserver,
public SingleLoginAttempt::Delegate {
public:
class Delegate {
@@ -85,13 +81,6 @@ class Login : public net::NetworkChangeNotifier::IPAddressObserver,
// net::NetworkChangeNotifier::IPAddressObserver implementation.
virtual void OnIPAddressChanged() OVERRIDE;
- // net::NetworkChangeNotifier::ConnectionTypeObserver implementation.
- virtual void OnConnectionTypeChanged(
- net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
-
- // net::NetworkChangeNotifier::DNSObserver implementation.
- virtual void OnDNSChanged(unsigned detail) OVERRIDE;
-
// SingleLoginAttempt::Delegate implementation.
virtual void OnConnect(
base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE;
@@ -100,8 +89,7 @@ class Login : public net::NetworkChangeNotifier::IPAddressObserver,
virtual void OnSettingsExhausted() OVERRIDE;
private:
- // Called by the various network notifications.
- void OnNetworkEvent();
+ void OnLogoff();
// Stops any existing reconnect timer and sets an initial reconnect
// interval.