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

Unified Diff: remoting/host/simple_host_process.cc

Issue 10106013: Chromoting: stopping the service if the host ID is permanently not recognized by the could. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feeback. Rebased. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/url_request_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/simple_host_process.cc
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index d9fba33c494cda061b13914f93173a02a59ec62c..eccc04ba5a278a4a97f1b75933563b33f82995b0 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -89,7 +89,7 @@ const char kVideoSwitchValueVp8Rtp[] = "vp8rtp";
namespace remoting {
-class SimpleHost {
+class SimpleHost : public HeartbeatSender::Listener {
public:
SimpleHost()
: message_loop_(MessageLoop::TYPE_UI),
@@ -100,6 +100,12 @@ class SimpleHost {
network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
}
+ // Overridden from HeartbeatSender::Listener
+ virtual void OnUnknownHostIdError() OVERRIDE {
+ LOG(ERROR) << "Host ID not found.";
+ Shutdown();
+ }
+
int Run() {
FilePath config_path = GetConfigPath();
JsonHostConfig config(config_path);
@@ -244,8 +250,8 @@ class SimpleHost {
signal_strategy_.get(), &key_pair_,
base::Bind(&SimpleHost::SetIT2MeAccessCode, host_, &key_pair_)));
} else {
- heartbeat_sender_.reset(
- new HeartbeatSender(host_id_, signal_strategy_.get(), &key_pair_));
+ heartbeat_sender_.reset(new HeartbeatSender(
+ this, host_id_, signal_strategy_.get(), &key_pair_));
}
host_->Start();
@@ -260,6 +266,10 @@ class SimpleHost {
}
}
+ void Shutdown() {
+ message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
+ }
+
MessageLoop message_loop_;
ChromotingHostContext context_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
« no previous file with comments | « remoting/host/remoting_me2me_host.cc ('k') | remoting/host/url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698