diff options
-rw-r--r-- | remoting/host/chromoting_host.cc | 18 | ||||
-rw-r--r-- | remoting/host/session_manager.cc | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 18f6399..740f0f6 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -68,15 +68,12 @@ void ChromotingHost::OnClientConnected(ClientConnection* client) { context_->main_message_loop(), capturer_.get(), encoder_.get()); - - // Immediately add the client and start the session. - session_->AddClient(client); - session_->Start(); - LOG(INFO) << "Session manager started"; - } else { - // If a session manager already exists we simply add the new client. - session_->AddClient(client); } + + // Immediately add the client and start the session. + session_->AddClient(client); + session_->Start(); + LOG(INFO) << "Session manager started"; } void ChromotingHost::OnClientDisconnected(ClientConnection* client) { @@ -89,6 +86,9 @@ void ChromotingHost::OnClientDisconnected(ClientConnection* client) { session_->Pause(); } + // Close the connection to client just to be safe. + client->Disconnect(); + // Also remove reference to ClientConnection from this object. client_ = NULL; } @@ -117,7 +117,6 @@ void ChromotingHost::OnConnectionOpened(ClientConnection* client) { void ChromotingHost::OnConnectionClosed(ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); - // Completes the client connection. LOG(INFO) << "Connection to client closed."; OnClientDisconnected(client_.get()); } @@ -125,7 +124,6 @@ void ChromotingHost::OnConnectionClosed(ClientConnection* client) { void ChromotingHost::OnConnectionFailed(ClientConnection* client) { DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); - // The client has disconnected. LOG(ERROR) << "Connection failed unexpectedly."; OnClientDisconnected(client_.get()); } diff --git a/remoting/host/session_manager.cc b/remoting/host/session_manager.cc index 3da20b7..7982b16 100644 --- a/remoting/host/session_manager.cc +++ b/remoting/host/session_manager.cc @@ -111,7 +111,7 @@ void SessionManager::DoStart() { DCHECK_EQ(capture_loop_, MessageLoop::current()); if (started_) { - NOTREACHED() << "Record session already started"; + NOTREACHED() << "Record session already started."; return; } @@ -128,7 +128,7 @@ void SessionManager::DoPause() { DCHECK_EQ(capture_loop_, MessageLoop::current()); if (!started_) { - NOTREACHED() << "Record session not started"; + NOTREACHED() << "Record session not started."; return; } |