summaryrefslogtreecommitdiffstats
path: root/remoting/host/simple_host_process.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-17 22:30:54 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-17 22:30:54 +0000
commitac31b78b597398068972d7858ec69fa1efb87621 (patch)
tree2fbd1b70dddeea64695b1e8329a58949d3910c94 /remoting/host/simple_host_process.cc
parent00270a9dcafa351e1465c92b1fce30d9639f03cc (diff)
downloadchromium_src-ac31b78b597398068972d7858ec69fa1efb87621.zip
chromium_src-ac31b78b597398068972d7858ec69fa1efb87621.tar.gz
chromium_src-ac31b78b597398068972d7858ec69fa1efb87621.tar.bz2
Chromoting: stopping the service if a permanent error is encountered (such as the host ID is permanently not recognized by the could or invalid host configuration).
BUG=123715,112160 Review URL: http://codereview.chromium.org/10106013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132675 0039d316-1c4b-4281-b951-d872f2087c98
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_;