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

Side by Side Diff: remoting/host/signaling_connector.cc

Issue 2798393007: Use SignalingAddress in SignalStrategy insterface. (Closed)
Patch Set: header Created 3 years, 8 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
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 "remoting/host/signaling_connector.h" 5 #include "remoting/host/signaling_connector.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "google_apis/google_api_keys.h" 12 #include "google_apis/google_api_keys.h"
13 #include "net/url_request/url_fetcher.h" 13 #include "net/url_request/url_fetcher.h"
14 #include "net/url_request/url_request_context_getter.h" 14 #include "net/url_request/url_request_context_getter.h"
15 #include "remoting/base/logging.h" 15 #include "remoting/base/logging.h"
16 #include "remoting/host/dns_blackhole_checker.h" 16 #include "remoting/host/dns_blackhole_checker.h"
17 #include "remoting/signaling/signaling_address.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 namespace { 21 namespace {
21 22
22 // The delay between reconnect attempts will increase exponentially up 23 // The delay between reconnect attempts will increase exponentially up
23 // to the maximum specified here. 24 // to the maximum specified here.
24 const int kMaxReconnectDelaySeconds = 10 * 60; 25 const int kMaxReconnectDelaySeconds = 10 * 60;
25 26
26 const char* SignalStrategyErrorToString(SignalStrategy::Error error){ 27 const char* SignalStrategyErrorToString(SignalStrategy::Error error){
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 64 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
64 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 65 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
65 } 66 }
66 67
67 void SignalingConnector::OnSignalStrategyStateChange( 68 void SignalingConnector::OnSignalStrategyStateChange(
68 SignalStrategy::State state) { 69 SignalStrategy::State state) {
69 DCHECK(CalledOnValidThread()); 70 DCHECK(CalledOnValidThread());
70 71
71 if (state == SignalStrategy::CONNECTED) { 72 if (state == SignalStrategy::CONNECTED) {
72 HOST_LOG << "Signaling connected. New JID: " 73 HOST_LOG << "Signaling connected. New JID: "
73 << signal_strategy_->GetLocalJid(); 74 << signal_strategy_->GetLocalAddress().jid();
74 reconnect_attempts_ = 0; 75 reconnect_attempts_ = 0;
75 } else if (state == SignalStrategy::DISCONNECTED) { 76 } else if (state == SignalStrategy::DISCONNECTED) {
76 HOST_LOG << "Signaling disconnected. error=" 77 HOST_LOG << "Signaling disconnected. error="
77 << SignalStrategyErrorToString(signal_strategy_->GetError()); 78 << SignalStrategyErrorToString(signal_strategy_->GetError());
78 reconnect_attempts_++; 79 reconnect_attempts_++;
79 80
80 if (signal_strategy_->GetError() == SignalStrategy::AUTHENTICATION_FAILED) 81 if (signal_strategy_->GetError() == SignalStrategy::AUTHENTICATION_FAILED)
81 oauth_token_getter_->InvalidateCache(); 82 oauth_token_getter_->InvalidateCache();
82 83
83 ScheduleTryReconnect(); 84 ScheduleTryReconnect();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 if (signal_strategy_->GetState() == SignalStrategy::DISCONNECTED) { 184 if (signal_strategy_->GetState() == SignalStrategy::DISCONNECTED) {
184 HOST_LOG << "Attempting to connect signaling."; 185 HOST_LOG << "Attempting to connect signaling.";
185 oauth_token_getter_->CallWithToken( 186 oauth_token_getter_->CallWithToken(
186 base::Bind(&SignalingConnector::OnAccessToken, AsWeakPtr())); 187 base::Bind(&SignalingConnector::OnAccessToken, AsWeakPtr()));
187 } 188 }
188 } 189 }
189 190
190 } // namespace remoting 191 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/register_support_host_request_unittest.cc ('k') | remoting/protocol/jingle_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698