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

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 feedback. 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
Index: remoting/host/simple_host_process.cc
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index f37d7a979077543847a97c3c11f3a73e1d2cd122..aadc49c35eba5bcf893ec6305147ae403d49106e 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::Delegate {
public:
SimpleHost()
: message_loop_(MessageLoop::TYPE_UI),
@@ -102,6 +102,12 @@ class SimpleHost {
network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
}
+ // Overridden from HeartbeatSender::Delegate
+ virtual void OnUnknownHostIdError() OVERRIDE {
+ LOG(ERROR) << "Host ID not found.";
+ Shutdown();
+ }
+
int Run() {
FilePath config_path = GetConfigPath();
JsonHostConfig config(config_path);
@@ -246,8 +252,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();
@@ -262,6 +268,10 @@ class SimpleHost {
}
}
+ void Shutdown() {
+ message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
+ }
+
MessageLoop message_loop_;
base::Thread file_io_thread_;
ChromotingHostContext context_;

Powered by Google App Engine
This is Rietveld 408576698