Index: remoting/host/remoting_me2me_host.cc |
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc |
index 0f8c94ac77c8316d587b4aeb80ce4ed6089894b3..edc74e1d40b3fe74a781aa112f1e0a4092ba40bc 100644 |
--- a/remoting/host/remoting_me2me_host.cc |
+++ b/remoting/host/remoting_me2me_host.cc |
@@ -27,6 +27,7 @@ |
#include "google_apis/google_api_keys.h" |
#include "ipc/ipc_channel.h" |
#include "ipc/ipc_channel_proxy.h" |
+#include "ipc/ipc_listener.h" |
#include "net/base/network_change_notifier.h" |
#include "net/socket/ssl_server_socket.h" |
#include "remoting/base/auto_thread_task_runner.h" |
@@ -132,7 +133,8 @@ class HostProcess |
void CreateAuthenticatorFactory(); |
// IPC::Listener implementation. |
- virtual bool OnMessageReceived(const IPC::Message& message); |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnChannelError() OVERRIDE; |
// HeartbeatSender::Listener overrides. |
virtual void OnUnknownHostIdError() OVERRIDE; |
@@ -181,6 +183,13 @@ class HostProcess |
void ResetHost(); |
+ // Crashes the process in response to a daemon's request. The daemon passes |
+ // the location of the code that detected the fatal error resulted in this |
+ // request. |
+ void OnCrash(const std::string& function_name, |
+ const std::string& file_name, |
+ const int& line_number); |
+ |
scoped_ptr<ChromotingHostContext> context_; |
scoped_ptr<IPC::ChannelProxy> daemon_channel_; |
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
@@ -246,15 +255,6 @@ HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context) |
base::Unretained(this))); |
} |
-// Crashes the process in response to a daemon's request. The daemon passes |
-// the location of the code that detected the fatal error resulted in this |
-// request. |
-void OnCrash(const std::string& function_name, |
- const std::string& file_name, |
- const int& line_number) { |
- CHECK(false); |
-} |
- |
bool HostProcess::InitWithCommandLine(const CommandLine* cmd_line) { |
#if defined(REMOTING_MULTI_PROCESS) |
// Parse the handle value and convert it to a handle/file descriptor. |
@@ -405,6 +405,10 @@ bool HostProcess::OnMessageReceived(const IPC::Message& message) { |
OnCrash) |
IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration, |
OnConfigUpdated) |
+ IPC_MESSAGE_FORWARD( |
+ ChromotingDaemonNetworkMsg_DesktopAttached, |
+ desktop_session_connector_, |
+ DesktopSessionConnector::OnDesktopSessionAgentAttached) |
IPC_MESSAGE_FORWARD(ChromotingDaemonNetworkMsg_TerminalDisconnected, |
desktop_session_connector_, |
DesktopSessionConnector::OnTerminalDisconnected) |
@@ -416,6 +420,16 @@ bool HostProcess::OnMessageReceived(const IPC::Message& message) { |
#endif // !defined(REMOTING_MULTI_PROCESS) |
} |
+void HostProcess::OnChannelError() { |
+ DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
+ |
+ // Shutdown the host if the daemon disconnected the channel. |
+ context_->network_task_runner()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&HostProcess::Shutdown, base::Unretained(this), |
+ kSuccessExitCode)); |
+} |
+ |
void HostProcess::StartHostProcess() { |
DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); |
@@ -830,6 +844,12 @@ void HostProcess::ResetHost() { |
resizing_host_observer_.reset(); |
} |
+void HostProcess::OnCrash(const std::string& function_name, |
+ const std::string& file_name, |
+ const int& line_number) { |
+ CHECK(false); |
+} |
+ |
} // namespace remoting |
int main(int argc, char** argv) { |