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

Side by Side Diff: jingle/notifier/communicator/login.cc

Issue 10873018: [net] Move DnsConfigService to NetworkChangeNotifier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | net/base/dns_reloader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jingle/notifier/communicator/login.h" 5 #include "jingle/notifier/communicator/login.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DVLOG(1) << "Detected IP address change"; 93 DVLOG(1) << "Detected IP address change";
94 OnNetworkEvent(); 94 OnNetworkEvent();
95 } 95 }
96 96
97 void Login::OnConnectionTypeChanged( 97 void Login::OnConnectionTypeChanged(
98 net::NetworkChangeNotifier::ConnectionType type) { 98 net::NetworkChangeNotifier::ConnectionType type) {
99 DVLOG(1) << "Detected connection type change"; 99 DVLOG(1) << "Detected connection type change";
100 OnNetworkEvent(); 100 OnNetworkEvent();
101 } 101 }
102 102
103 void Login::OnDNSChanged(unsigned detail) { 103 void Login::OnDNSChanged() {
104 DVLOG(1) << "Detected DNS change"; 104 DVLOG(1) << "Detected DNS change";
105 OnNetworkEvent(); 105 OnNetworkEvent();
106 } 106 }
107 107
108 void Login::OnNetworkEvent() { 108 void Login::OnNetworkEvent() {
109 // Reconnect in 1 to 9 seconds (vary the time a little to try to 109 // Reconnect in 1 to 9 seconds (vary the time a little to try to
110 // avoid spikey behavior on network hiccups). 110 // avoid spikey behavior on network hiccups).
111 reconnect_interval_ = base::TimeDelta::FromSeconds(base::RandInt(1, 9)); 111 reconnect_interval_ = base::TimeDelta::FromSeconds(base::RandInt(1, 9));
112 TryReconnect(); 112 TryReconnect();
113 delegate_->OnTransientDisconnection(); 113 delegate_->OnTransientDisconnection();
(...skipping 20 matching lines...) Expand all
134 const base::TimeDelta kMaxReconnectInterval = 134 const base::TimeDelta kMaxReconnectInterval =
135 base::TimeDelta::FromMinutes(30); 135 base::TimeDelta::FromMinutes(30);
136 reconnect_interval_ *= 2; 136 reconnect_interval_ *= 2;
137 if (reconnect_interval_ > kMaxReconnectInterval) 137 if (reconnect_interval_ > kMaxReconnectInterval)
138 reconnect_interval_ = kMaxReconnectInterval; 138 reconnect_interval_ = kMaxReconnectInterval;
139 DVLOG(1) << "Reconnecting..."; 139 DVLOG(1) << "Reconnecting...";
140 StartConnection(); 140 StartConnection();
141 } 141 }
142 142
143 } // namespace notifier 143 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/login.h ('k') | net/base/dns_reloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698