OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/host/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // No-op if this object is not started yet. | 114 // No-op if this object is not started yet. |
115 { | 115 { |
116 base::AutoLock auto_lock(lock_); | 116 base::AutoLock auto_lock(lock_); |
117 if (state_ != kStarted) { | 117 if (state_ != kStarted) { |
118 state_ = kStopped; | 118 state_ = kStopped; |
119 return; | 119 return; |
120 } | 120 } |
121 state_ = kStopped; | 121 state_ = kStopped; |
122 } | 122 } |
123 | 123 |
124 // Tell the session to pause and then disconnect all clients. | 124 // Tell the session to stop and then disconnect all clients. |
125 if (recorder_.get()) { | 125 if (recorder_.get()) { |
126 recorder_->Pause(); | 126 recorder_->Stop(NULL); |
127 recorder_->RemoveAllConnections(); | 127 recorder_->RemoveAllConnections(); |
128 } | 128 } |
129 | 129 |
130 // Disconnect the client. | 130 // Disconnect the client. |
131 if (connection_) { | 131 if (connection_) { |
132 connection_->Disconnect(); | 132 connection_->Disconnect(); |
133 } | 133 } |
134 | 134 |
135 // Stop the heartbeat sender. | 135 // Stop the heartbeat sender. |
136 if (heartbeat_sender_) { | 136 if (heartbeat_sender_) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Immediately add the connection and start the session. | 176 // Immediately add the connection and start the session. |
177 recorder_->AddConnection(connection); | 177 recorder_->AddConnection(connection); |
178 recorder_->Start(); | 178 recorder_->Start(); |
179 VLOG(1) << "Session manager started"; | 179 VLOG(1) << "Session manager started"; |
180 } | 180 } |
181 | 181 |
182 void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) { | 182 void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) { |
183 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); | 183 DCHECK_EQ(context_->main_message_loop(), MessageLoop::current()); |
184 | 184 |
185 // Remove the connection from the session manager and pause the session. | 185 // Remove the connection from the session manager and stop the session. |
186 // TODO(hclam): Pause only if the last connection disconnected. | 186 // TODO(hclam): Stop only if the last connection disconnected. |
187 if (recorder_.get()) { | 187 if (recorder_.get()) { |
188 recorder_->RemoveConnection(connection); | 188 recorder_->RemoveConnection(connection); |
189 recorder_->Pause(); | 189 recorder_->Stop(NULL); |
190 } | 190 } |
191 | 191 |
192 // Close the connection to connection just to be safe. | 192 // Close the connection to connection just to be safe. |
193 connection->Disconnect(); | 193 connection->Disconnect(); |
194 | 194 |
195 // Also remove reference to ConnectionToClient from this object. | 195 // Also remove reference to ConnectionToClient from this object. |
196 connection_ = NULL; | 196 connection_ = NULL; |
197 } | 197 } |
198 | 198 |
199 //////////////////////////////////////////////////////////////////////////// | 199 //////////////////////////////////////////////////////////////////////////// |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 return NULL; | 337 return NULL; |
338 } | 338 } |
339 | 339 |
340 std::string ChromotingHost::GenerateHostAuthToken( | 340 std::string ChromotingHost::GenerateHostAuthToken( |
341 const std::string& encoded_client_token) { | 341 const std::string& encoded_client_token) { |
342 // TODO(ajwong): Return the signature of this instead. | 342 // TODO(ajwong): Return the signature of this instead. |
343 return encoded_client_token; | 343 return encoded_client_token; |
344 } | 344 } |
345 | 345 |
346 } // namespace remoting | 346 } // namespace remoting |
OLD | NEW |