diff options
author | sergeyu <sergeyu@chromium.org> | 2015-10-30 16:11:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-30 23:12:33 +0000 |
commit | 09750216bef8bc9f2953e4eee9f66801bf034fa4 (patch) | |
tree | cb45b2450860bbd33581c7361cc720e05db706a6 /remoting/host/client_session.cc | |
parent | 8fe437a06a287010a48833eb657dde801da306a4 (diff) | |
download | chromium_src-09750216bef8bc9f2953e4eee9f66801bf034fa4.zip chromium_src-09750216bef8bc9f2953e4eee9f66801bf034fa4.tar.gz chromium_src-09750216bef8bc9f2953e4eee9f66801bf034fa4.tar.bz2 |
Fix chromoting host to report error when closing connection.
Previously host would often close session without reporting the reason
to the client. Added two new error codes and updated the host to report
session termination reason when appropriate.
BUG=548261
Review URL: https://codereview.chromium.org/1430503002
Cr-Commit-Position: refs/heads/master@{#357215}
Diffstat (limited to 'remoting/host/client_session.cc')
-rw-r--r-- | remoting/host/client_session.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 1ddfd38..1008589 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -288,15 +288,15 @@ void ClientSession::OnConnectionAuthenticated( is_authenticated_ = true; if (max_duration_ > base::TimeDelta()) { - // TODO(simonmorris): Let Disconnect() tell the client that the - // disconnection was caused by the session exceeding its maximum duration. - max_duration_timer_.Start(FROM_HERE, max_duration_, - this, &ClientSession::DisconnectSession); + max_duration_timer_.Start( + FROM_HERE, max_duration_, + base::Bind(&ClientSession::DisconnectSession, base::Unretained(this), + protocol::MAX_SESSION_LENGTH)); } // Disconnect the session if the connection was rejected by the host. if (!event_handler_->OnSessionAuthenticated(this)) { - DisconnectSession(); + DisconnectSession(protocol::SESSION_REJECTED); return; } @@ -305,8 +305,7 @@ void ClientSession::OnConnectionAuthenticated( desktop_environment_ = desktop_environment_factory_->Create(weak_factory_.GetWeakPtr()); if (!desktop_environment_) { - // TODO(sergeyu): Fix the host to return an error code (crbug.com/543334). - DisconnectSession(); + DisconnectSession(protocol::HOST_CONFIGURATION_ERROR); return; } @@ -428,7 +427,7 @@ const std::string& ClientSession::client_jid() const { return client_jid_; } -void ClientSession::DisconnectSession() { +void ClientSession::DisconnectSession(protocol::ErrorCode error) { DCHECK(CalledOnValidThread()); DCHECK(connection_.get()); @@ -436,7 +435,7 @@ void ClientSession::DisconnectSession() { // This triggers OnConnectionClosed(), and the session may be destroyed // as the result, so this call must be the last in this method. - connection_->Disconnect(); + connection_->Disconnect(error); } void ClientSession::OnLocalMouseMoved(const webrtc::DesktopVector& position) { |