summaryrefslogtreecommitdiffstats
path: root/remoting/host/simple_host_process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/host/simple_host_process.cc')
-rw-r--r--remoting/host/simple_host_process.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index d9fba33..eccc04b 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_;