summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-22 00:51:26 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-22 00:51:26 +0000
commitdda4da3bad346484b6a4253b6c504845e8d3e67b (patch)
tree7571fc57b2dc8e19035b0331e33b20aa1115f39c /remoting
parentb8591e1c80f813f3f9edd3a018396330365b07b2 (diff)
downloadchromium_src-dda4da3bad346484b6a4253b6c504845e8d3e67b.zip
chromium_src-dda4da3bad346484b6a4253b6c504845e8d3e67b.tar.gz
chromium_src-dda4da3bad346484b6a4253b6c504845e8d3e67b.tar.bz2
Handle disconnection events properly for unauthenticated clients.
Previously when receiving disconnection event the host was stopping screen recorder even when there are other active sessions. Obviously this is wrong. BUG=128643 Review URL: https://chromiumcodereview.appspot.com/10409021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/chromoting_host.cc21
-rw-r--r--remoting/host/client_session.cc4
-rw-r--r--remoting/host/client_session.h3
3 files changed, 19 insertions, 9 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index a1285544..1c90477 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -254,15 +254,20 @@ void ChromotingHost::OnSessionClosed(ClientSession* client) {
recorder_->RemoveConnection(client->connection());
}
- FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
- OnClientDisconnected(client->client_jid()));
-
- if (recorder_.get()) {
- // Currently we don't allow more than one simultaneous connection,
- // so we need to shutdown recorder when a client disconnects.
- StopScreenRecorder();
+ if (client->is_authenticated()) {
+ FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
+ OnClientDisconnected(client->client_jid()));
+
+ // TODO(sergeyu): This teardown logic belongs to ClientSession
+ // class. It should start/stop screen recorder or tell the host
+ // when to do it.
+ if (recorder_.get()) {
+ // Currently we don't allow more than one simultaneous connection,
+ // so we need to shutdown recorder when a client disconnects.
+ StopScreenRecorder();
+ }
+ desktop_environment_->OnSessionFinished();
}
- desktop_environment_->OnSessionFinished();
}
void ChromotingHost::OnSessionSequenceNumber(ClientSession* session,
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 7db5498..180ecc8 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -21,6 +21,7 @@ ClientSession::ClientSession(
: event_handler_(event_handler),
connection_(connection.Pass()),
client_jid_(connection_->session()->jid()),
+ is_authenticated_(false),
host_event_stub_(host_event_stub),
input_tracker_(host_event_stub_),
remote_input_filter_(&input_tracker_),
@@ -90,6 +91,7 @@ void ClientSession::OnConnectionAuthenticated(
protocol::ConnectionToClient* connection) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
+ is_authenticated_ = true;
auth_input_filter_.set_input_stub(&disable_input_filter_);
event_handler_->OnSessionAuthenticated(this);
}
@@ -107,7 +109,7 @@ void ClientSession::OnConnectionClosed(
protocol::ErrorCode error) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
- if (!auth_input_filter_.input_stub())
+ if (!is_authenticated_)
event_handler_->OnSessionAuthenticationFailed(this);
auth_input_filter_.set_input_stub(NULL);
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 084d153..e61e846 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -109,6 +109,8 @@ class ClientSession : public protocol::HostEventStub,
const std::string& client_jid() { return client_jid_; }
+ bool is_authenticated() { return is_authenticated_; }
+
// Indicate that local mouse activity has been detected. This causes remote
// inputs to be ignored for a short time so that the local user will always
// have the upper hand in 'pointer wars'.
@@ -125,6 +127,7 @@ class ClientSession : public protocol::HostEventStub,
scoped_ptr<protocol::ConnectionToClient> connection_;
std::string client_jid_;
+ bool is_authenticated_;
// The host event stub to which this object delegates. This is the final
// element in the input pipeline, whose components appear in order below.