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

Side by Side Diff: remoting/host/chromoting_host.cc

Issue 10409021: Handle disconnection events properly for unauthenicated clients. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/host/client_session.h » ('j') | remoting/host/client_session.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 void ChromotingHost::OnSessionClosed(ClientSession* client) { 244 void ChromotingHost::OnSessionClosed(ClientSession* client) {
245 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); 245 DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
246 246
247 scoped_ptr<ClientSession> client_destroyer(client); 247 scoped_ptr<ClientSession> client_destroyer(client);
248 248
249 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client); 249 ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client);
250 CHECK(it != clients_.end()); 250 CHECK(it != clients_.end());
251 clients_.erase(it); 251 clients_.erase(it);
252 252
253 if (recorder_.get()) { 253 if (client->is_authenticated()) {
254 recorder_->RemoveConnection(client->connection()); 254 if (recorder_.get()) {
255 recorder_->RemoveConnection(client->connection());
Wez 2012/05/18 20:20:57 nit: It should be safe to RemoveConnection() for a
Sergey Ulanov 2012/05/21 18:20:13 It doesn't make sense to remove the connection if
Wez 2012/05/21 20:33:50 True, but you're testing whether |recorder_| is se
Sergey Ulanov 2012/05/21 22:27:55 Done.
256 }
257
258 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
259 OnClientDisconnected(client->client_jid()));
Wez 2012/05/18 20:20:57 This changes the semantics of OnClientDisconnected
Sergey Ulanov 2012/05/21 18:20:13 Yes. I think for such clients the observers will s
260
261 if (recorder_.get()) {
262 // Currently we don't allow more than one simultaneous connection,
263 // so we need to shutdown recorder when a client disconnects.
264 StopScreenRecorder();
265 }
266 desktop_environment_->OnSessionFinished();
255 } 267 }
256
257 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
258 OnClientDisconnected(client->client_jid()));
259
260 if (recorder_.get()) {
261 // Currently we don't allow more than one simultaneous connection,
262 // so we need to shutdown recorder when a client disconnects.
263 StopScreenRecorder();
264 }
265 desktop_environment_->OnSessionFinished();
266 } 268 }
267 269
268 void ChromotingHost::OnSessionSequenceNumber(ClientSession* session, 270 void ChromotingHost::OnSessionSequenceNumber(ClientSession* session,
269 int64 sequence_number) { 271 int64 sequence_number) {
270 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); 272 DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
271 if (recorder_.get()) 273 if (recorder_.get())
272 recorder_->UpdateSequenceNumber(sequence_number); 274 recorder_->UpdateSequenceNumber(sequence_number);
273 } 275 }
274 276
275 void ChromotingHost::OnSessionRouteChange( 277 void ChromotingHost::OnSessionRouteChange(
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 OnShutdown()); 430 OnShutdown());
429 431
430 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); 432 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin();
431 it != shutdown_tasks_.end(); ++it) { 433 it != shutdown_tasks_.end(); ++it) {
432 it->Run(); 434 it->Run();
433 } 435 }
434 shutdown_tasks_.clear(); 436 shutdown_tasks_.clear();
435 } 437 }
436 438
437 } // namespace remoting 439 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/client_session.h » ('j') | remoting/host/client_session.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698