summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java4
-rw-r--r--remoting/client/plugin/chromoting_instance.cc6
-rw-r--r--remoting/host/chromoting_host.cc8
-rw-r--r--remoting/host/chromoting_host_unittest.cc10
-rw-r--r--remoting/host/chromoting_messages.h7
-rw-r--r--remoting/host/client_session.cc17
-rw-r--r--remoting/host/client_session.h2
-rw-r--r--remoting/host/client_session_control.h3
-rw-r--r--remoting/host/client_session_unittest.cc6
-rw-r--r--remoting/host/continue_window.cc5
-rw-r--r--remoting/host/desktop_session_agent.cc5
-rw-r--r--remoting/host/desktop_session_agent.h2
-rw-r--r--remoting/host/desktop_session_proxy.cc4
-rw-r--r--remoting/host/desktop_session_proxy.h3
-rw-r--r--remoting/host/disconnect_window_chromeos.cc2
-rw-r--r--remoting/host/disconnect_window_linux.cc4
-rw-r--r--remoting/host/disconnect_window_mac.mm2
-rw-r--r--remoting/host/disconnect_window_win.cc2
-rw-r--r--remoting/host/host_mock_objects.h2
-rw-r--r--remoting/host/host_window_proxy.cc10
-rw-r--r--remoting/host/ipc_desktop_environment.cc2
-rw-r--r--remoting/host/ipc_desktop_environment_unittest.cc4
-rw-r--r--remoting/host/local_input_monitor_chromeos.cc2
-rw-r--r--remoting/host/local_input_monitor_mac.mm2
-rw-r--r--remoting/host/local_input_monitor_unittest.cc2
-rw-r--r--remoting/host/local_input_monitor_win.cc2
-rw-r--r--remoting/host/local_input_monitor_x11.cc2
-rw-r--r--remoting/host/win/worker_process_launcher_unittest.cc6
-rw-r--r--remoting/protocol/connection_to_client.cc4
-rw-r--r--remoting/protocol/connection_to_client.h2
-rw-r--r--remoting/protocol/connection_to_client_unittest.cc4
-rw-r--r--remoting/protocol/errors.cc2
-rw-r--r--remoting/protocol/errors.h4
-rw-r--r--remoting/protocol/fake_session.cc3
-rw-r--r--remoting/protocol/fake_session.h2
-rw-r--r--remoting/protocol/jingle_messages.cc2
-rw-r--r--remoting/protocol/jingle_messages.h2
-rw-r--r--remoting/protocol/jingle_session.cc123
-rw-r--r--remoting/protocol/jingle_session.h7
-rw-r--r--remoting/protocol/jingle_session_manager.cc2
-rw-r--r--remoting/protocol/protocol_mock_objects.h4
-rw-r--r--remoting/protocol/session.h8
-rw-r--r--remoting/resources/remoting_strings.grd7
-rw-r--r--remoting/webapp/base/js/chromoting_event.js2
-rw-r--r--remoting/webapp/base/js/client_session.js28
-rw-r--r--remoting/webapp/base/js/error.js6
46 files changed, 193 insertions, 145 deletions
diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
index f5b9498..5e4cd5e 100644
--- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
+++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java
@@ -77,7 +77,9 @@ public class JniInterface {
SIGNALING_ERROR(6, R.string.error_p2p_failure),
SIGNALING_TIMEOUT(7, R.string.error_p2p_failure),
HOST_OVERLOAD(8, R.string.error_host_overload),
- UNKNOWN_ERROR(9, R.string.error_unexpected);
+ MAX_SESSION_LENGTH(9, R.string.error_max_session_length),
+ HOST_CONFIGURATION_ERROR(10, R.string.error_host_configuration_error),
+ UNKNOWN_ERROR(11, R.string.error_unexpected);
private final int mValue;
private final int mMessage;
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index d29b608..eef2a20 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -120,6 +120,12 @@ std::string ConnectionErrorToString(protocol::ErrorCode error) {
case protocol::HOST_OVERLOAD:
return "HOST_OVERLOAD";
+ case protocol::MAX_SESSION_LENGTH:
+ return "MAX_SESSION_LENGTH";
+
+ case protocol::HOST_CONFIGURATION_ERROR:
+ return "HOST_CONFIGURATION_ERROR";
+
case protocol::CHANNEL_CONNECTION_ERROR:
case protocol::SIGNALING_ERROR:
case protocol::SIGNALING_TIMEOUT:
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index b2bd1f9..ff85892 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -94,7 +94,7 @@ ChromotingHost::~ChromotingHost() {
// Disconnect all of the clients.
while (!clients_.empty()) {
- clients_.front()->DisconnectSession();
+ clients_.front()->DisconnectSession(protocol::OK);
}
// Destroy the session manager to make sure that |signal_strategy_| does not
@@ -177,7 +177,7 @@ void ChromotingHost::OnSessionAuthenticating(ClientSession* client) {
if (login_backoff_.ShouldRejectRequest()) {
LOG(WARNING) << "Disconnecting client " << client->client_jid() << " due to"
" an overload of failed login attempts.";
- client->DisconnectSession();
+ client->DisconnectSession(protocol::HOST_OVERLOAD);
return;
}
login_backoff_.InformOfRequest(false);
@@ -195,7 +195,7 @@ bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
while (it != clients_.end()) {
ClientSession* other_client = *it++;
if (other_client != client)
- other_client->DisconnectSession();
+ other_client->DisconnectSession(protocol::OK);
}
// Disconnects above must have destroyed all other clients.
@@ -307,7 +307,7 @@ void ChromotingHost::DisconnectAllClients() {
while (!clients_.empty()) {
size_t size = clients_.size();
- clients_.front()->DisconnectSession();
+ clients_.front()->DisconnectSession(protocol::OK);
CHECK_EQ(clients_.size(), size - 1);
}
}
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index 0eeac1b..6cbc4ea 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -367,7 +367,7 @@ class ChromotingHostTest : public testing::Test {
MockConnectionToClient* connection = get_connection(connection_index);
Expectation client_disconnected =
- EXPECT_CALL(*connection, Disconnect())
+ EXPECT_CALL(*connection, Disconnect(_))
.After(after)
.WillOnce(InvokeWithoutArgs(CreateFunctor(
this, &ChromotingHostTest::NotifyClientSessionClosed,
@@ -568,7 +568,7 @@ TEST_F(ChromotingHostTest, IncomingSessionDeclined) {
TEST_F(ChromotingHostTest, IncomingSessionAccepted) {
ExpectHostAndSessionManagerStart();
- EXPECT_CALL(*session_unowned1_, Close()).WillOnce(InvokeWithoutArgs(
+ EXPECT_CALL(*session_unowned1_, Close(_)).WillOnce(InvokeWithoutArgs(
this, &ChromotingHostTest::NotifyConnectionClosed1));
EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
EXPECT_CALL(host_status_observer_, OnShutdown());
@@ -586,7 +586,7 @@ TEST_F(ChromotingHostTest, IncomingSessionAccepted) {
TEST_F(ChromotingHostTest, LoginBackOffUponConnection) {
ExpectHostAndSessionManagerStart();
- EXPECT_CALL(*session_unowned1_, Close()).WillOnce(
+ EXPECT_CALL(*session_unowned1_, Close(_)).WillOnce(
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed1));
EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
EXPECT_CALL(host_status_observer_, OnShutdown());
@@ -609,10 +609,10 @@ TEST_F(ChromotingHostTest, LoginBackOffUponConnection) {
TEST_F(ChromotingHostTest, LoginBackOffUponAuthenticating) {
Expectation start = ExpectHostAndSessionManagerStart();
- EXPECT_CALL(*session_unowned1_, Close()).WillOnce(
+ EXPECT_CALL(*session_unowned1_, Close(_)).WillOnce(
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed1));
- EXPECT_CALL(*session_unowned2_, Close()).WillOnce(
+ EXPECT_CALL(*session_unowned2_, Close(_)).WillOnce(
InvokeWithoutArgs(this, &ChromotingHostTest::NotifyConnectionClosed2));
EXPECT_CALL(host_status_observer_, OnShutdown());
diff --git a/remoting/host/chromoting_messages.h b/remoting/host/chromoting_messages.h
index 3a27b38..793156b 100644
--- a/remoting/host/chromoting_messages.h
+++ b/remoting/host/chromoting_messages.h
@@ -9,6 +9,7 @@
#include "net/base/ip_endpoint.h"
#include "remoting/host/chromoting_param_traits.h"
#include "remoting/host/screen_resolution.h"
+#include "remoting/protocol/errors.h"
#include "remoting/protocol/transport.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -180,8 +181,12 @@ IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_MouseCursor,
IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_InjectClipboardEvent,
std::string /* serialized_event */ )
+IPC_ENUM_TRAITS_MAX_VALUE(remoting::protocol::ErrorCode,
+ remoting::protocol::ERROR_CODE_MAX)
+
// Requests the network process to terminate the client session.
-IPC_MESSAGE_CONTROL0(ChromotingDesktopNetworkMsg_DisconnectSession)
+IPC_MESSAGE_CONTROL1(ChromotingDesktopNetworkMsg_DisconnectSession,
+ remoting::protocol::ErrorCode /* error */)
// Carries an audio packet from the desktop session agent to the client.
// |serialized_packet| is a serialized AudioPacket.
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) {
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index d41e83e..348552d 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -130,7 +130,7 @@ class ClientSession
// ClientSessionControl interface.
const std::string& client_jid() const override;
- void DisconnectSession() override;
+ void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override;
void ResetVideoPipeline() override;
diff --git a/remoting/host/client_session_control.h b/remoting/host/client_session_control.h
index 30cb15b..47d2089 100644
--- a/remoting/host/client_session_control.h
+++ b/remoting/host/client_session_control.h
@@ -6,6 +6,7 @@
#define REMOTING_HOST_CLIENT_SESSION_CONTROL_H_
#include "base/basictypes.h"
+#include "remoting/protocol/errors.h"
namespace webrtc {
class DesktopVector;
@@ -25,7 +26,7 @@ class ClientSessionControl {
// Disconnects the client session, tears down transport resources and stops
// scheduler components.
- virtual void DisconnectSession() = 0;
+ virtual void DisconnectSession(protocol::ErrorCode error) = 0;
// Called when local mouse movement is detected.
virtual void OnLocalMouseMoved(const webrtc::DesktopVector& position) = 0;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index 696f83f..81a3b6f 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -239,7 +239,7 @@ void ClientSessionTest::CreateClientSession() {
EXPECT_CALL(*connection, client_stub())
.WillRepeatedly(Return(&client_stub_));
EXPECT_CALL(*connection, video_stub()).WillRepeatedly(Return(&video_stub_));
- EXPECT_CALL(*connection, Disconnect());
+ EXPECT_CALL(*connection, Disconnect(_));
connection_ = connection.get();
client_session_.reset(new ClientSession(
@@ -258,7 +258,7 @@ void ClientSessionTest::CreateClientSession() {
}
void ClientSessionTest::DisconnectClientSession() {
- client_session_->DisconnectSession();
+ client_session_->DisconnectSession(protocol::OK);
// MockSession won't trigger OnConnectionClosed, so fake it.
client_session_->OnConnectionClosed(client_session_->connection(),
protocol::OK);
@@ -432,7 +432,7 @@ TEST_F(ClientSessionTest, ClipboardStubFilter) {
mouse_event.set_y(301);
connection_->input_stub()->InjectMouseEvent(mouse_event);
- client_session_->DisconnectSession();
+ client_session_->DisconnectSession(protocol::OK);
client_session_->OnConnectionClosed(connection_, protocol::OK);
client_session_.reset();
}
diff --git a/remoting/host/continue_window.cc b/remoting/host/continue_window.cc
index 35a7f90..9871591 100644
--- a/remoting/host/continue_window.cc
+++ b/remoting/host/continue_window.cc
@@ -54,11 +54,10 @@ void ContinueWindow::DisconnectSession() {
disconnect_timer_.Stop();
if (client_session_control_.get())
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(protocol::MAX_SESSION_LENGTH);
}
-ContinueWindow::ContinueWindow() {
-}
+ContinueWindow::ContinueWindow() {}
void ContinueWindow::OnSessionExpired() {
DCHECK(CalledOnValidThread());
diff --git a/remoting/host/desktop_session_agent.cc b/remoting/host/desktop_session_agent.cc
index 840d588..23d05f2 100644
--- a/remoting/host/desktop_session_agent.cc
+++ b/remoting/host/desktop_session_agent.cc
@@ -24,6 +24,7 @@
#include "remoting/proto/control.pb.h"
#include "remoting/proto/event.pb.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/errors.h"
#include "remoting/protocol/input_event_tracker.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
@@ -222,8 +223,8 @@ const std::string& DesktopSessionAgent::client_jid() const {
return client_jid_;
}
-void DesktopSessionAgent::DisconnectSession() {
- SendToNetwork(new ChromotingDesktopNetworkMsg_DisconnectSession());
+void DesktopSessionAgent::DisconnectSession(protocol::ErrorCode error) {
+ SendToNetwork(new ChromotingDesktopNetworkMsg_DisconnectSession(error));
}
void DesktopSessionAgent::OnLocalMouseMoved(
diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h
index 9d6c4e0..8f407d1 100644
--- a/remoting/host/desktop_session_agent.h
+++ b/remoting/host/desktop_session_agent.h
@@ -107,7 +107,7 @@ class DesktopSessionAgent
// ClientSessionControl interface.
const std::string& client_jid() const override;
- void DisconnectSession() override;
+ void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override;
void ResetVideoPipeline() override;
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 27e8af6..4536500 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -331,12 +331,12 @@ void DesktopSessionProxy::SetMouseCursorMonitor(
mouse_cursor_monitor_ = mouse_cursor_monitor;
}
-void DesktopSessionProxy::DisconnectSession() {
+void DesktopSessionProxy::DisconnectSession(protocol::ErrorCode error) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
// Disconnect the client session if it hasn't been disconnected yet.
if (client_session_control_.get())
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(error);
}
void DesktopSessionProxy::InjectClipboardEvent(
diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h
index bae2a80..7ebf6e8 100644
--- a/remoting/host/desktop_session_proxy.h
+++ b/remoting/host/desktop_session_proxy.h
@@ -20,6 +20,7 @@
#include "remoting/host/screen_resolution.h"
#include "remoting/proto/event.pb.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/errors.h"
#include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
namespace base {
@@ -101,7 +102,7 @@ class DesktopSessionProxy
void DetachFromDesktop();
// Disconnects the client session that owns |this|.
- void DisconnectSession();
+ void DisconnectSession(protocol::ErrorCode error);
// Stores |audio_capturer| to be used to post captured audio packets. Called
// on the |audio_capture_task_runner_| thread.
diff --git a/remoting/host/disconnect_window_chromeos.cc b/remoting/host/disconnect_window_chromeos.cc
index d2f8c01..981e3f6 100644
--- a/remoting/host/disconnect_window_chromeos.cc
+++ b/remoting/host/disconnect_window_chromeos.cc
@@ -40,7 +40,7 @@ void DisconnectWindowAura::Start(
base::string16 helper_name;
ash::Shell::GetInstance()->system_tray_notifier()->NotifyScreenShareStart(
base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control),
+ client_session_control, protocol::OK),
helper_name);
}
diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc
index b913ea5..0d9fae1 100644
--- a/remoting/host/disconnect_window_linux.cc
+++ b/remoting/host/disconnect_window_linux.cc
@@ -172,7 +172,7 @@ void DisconnectWindowGtk::OnClicked(GtkButton* button) {
DCHECK(CalledOnValidThread());
if (client_session_control_.get())
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(protocol::OK);
}
gboolean DisconnectWindowGtk::OnDelete(GtkWidget* window,
@@ -180,7 +180,7 @@ gboolean DisconnectWindowGtk::OnDelete(GtkWidget* window,
DCHECK(CalledOnValidThread());
if (client_session_control_.get())
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(protocol::OK);
return TRUE;
}
diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm
index 623c3af..06c9762 100644
--- a/remoting/host/disconnect_window_mac.mm
+++ b/remoting/host/disconnect_window_mac.mm
@@ -63,7 +63,7 @@ void DisconnectWindowMac::Start(
// Create the window.
base::Closure disconnect_callback =
base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control);
+ client_session_control, protocol::OK);
std::string client_jid = client_session_control->client_jid();
std::string username = client_jid.substr(0, client_jid.find('/'));
window_controller_ =
diff --git a/remoting/host/disconnect_window_win.cc b/remoting/host/disconnect_window_win.cc
index c0a7ecc..dff48cec 100644
--- a/remoting/host/disconnect_window_win.cc
+++ b/remoting/host/disconnect_window_win.cc
@@ -262,7 +262,7 @@ void DisconnectWindowWin::EndDialog() {
}
if (client_session_control_)
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(protocol::OK);
}
// Returns |control| rectangle in the dialog coordinates.
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h
index d4462c8..eaae574 100644
--- a/remoting/host/host_mock_objects.h
+++ b/remoting/host/host_mock_objects.h
@@ -61,7 +61,7 @@ class MockClientSessionControl : public ClientSessionControl {
~MockClientSessionControl() override;
MOCK_CONST_METHOD0(client_jid, const std::string&());
- MOCK_METHOD0(DisconnectSession, void());
+ MOCK_METHOD1(DisconnectSession, void(protocol::ErrorCode error));
MOCK_METHOD1(OnLocalMouseMoved, void(const webrtc::DesktopVector&));
MOCK_METHOD1(SetDisableInputs, void(bool));
MOCK_METHOD0(ResetVideoPipeline, void());
diff --git a/remoting/host/host_window_proxy.cc b/remoting/host/host_window_proxy.cc
index bdaf519..e5be616 100644
--- a/remoting/host/host_window_proxy.cc
+++ b/remoting/host/host_window_proxy.cc
@@ -38,7 +38,7 @@ class HostWindowProxy::Core
// ClientSessionControl interface.
const std::string& client_jid() const override;
- void DisconnectSession() override;
+ void DisconnectSession(protocol::ErrorCode error) override;
void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
void SetDisableInputs(bool disable_inputs) override;
void ResetVideoPipeline() override;
@@ -143,15 +143,15 @@ const std::string& HostWindowProxy::Core::client_jid() const {
return client_jid_;
}
-void HostWindowProxy::Core::DisconnectSession() {
+void HostWindowProxy::Core::DisconnectSession(protocol::ErrorCode error) {
if (!caller_task_runner_->BelongsToCurrentThread()) {
- caller_task_runner_->PostTask(FROM_HERE,
- base::Bind(&Core::DisconnectSession, this));
+ caller_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&Core::DisconnectSession, this, error));
return;
}
if (client_session_control_.get())
- client_session_control_->DisconnectSession();
+ client_session_control_->DisconnectSession(error);
}
void HostWindowProxy::Core::OnLocalMouseMoved(
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index 37bd89f..cc6417e 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -222,7 +222,7 @@ void IpcDesktopEnvironmentFactory::OnTerminalDisconnected(int terminal_id) {
active_connections_.erase(i);
// Disconnect the client session.
- desktop_session_proxy->DisconnectSession();
+ desktop_session_proxy->DisconnectSession(protocol::OK);
}
}
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc
index 9bfb621..1de0f29 100644
--- a/remoting/host/ipc_desktop_environment_unittest.cc
+++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -275,9 +275,9 @@ void IpcDesktopEnvironmentTest::SetUp() {
EXPECT_CALL(client_session_control_, client_jid())
.Times(AnyNumber())
.WillRepeatedly(ReturnRef(client_jid_));
- EXPECT_CALL(client_session_control_, DisconnectSession())
+ EXPECT_CALL(client_session_control_, DisconnectSession(_))
.Times(AnyNumber())
- .WillRepeatedly(Invoke(
+ .WillRepeatedly(InvokeWithoutArgs(
this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment));
EXPECT_CALL(client_session_control_, OnLocalMouseMoved(_))
.Times(0);
diff --git a/remoting/host/local_input_monitor_chromeos.cc b/remoting/host/local_input_monitor_chromeos.cc
index dab02e5..1594f87 100644
--- a/remoting/host/local_input_monitor_chromeos.cc
+++ b/remoting/host/local_input_monitor_chromeos.cc
@@ -133,7 +133,7 @@ void LocalInputMonitorChromeos::Core::HandleKeyPressed(
key_event.key_code() == ui::VKEY_ESCAPE) {
caller_task_runner_->PostTask(
FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control_));
+ client_session_control_, protocol::OK));
}
}
diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm
index e3bd3d5..1388877 100644
--- a/remoting/host/local_input_monitor_mac.mm
+++ b/remoting/host/local_input_monitor_mac.mm
@@ -270,7 +270,7 @@ void LocalInputMonitorMac::Core::OnLocalMouseMoved(
void LocalInputMonitorMac::Core::OnDisconnectShortcut() {
caller_task_runner_->PostTask(
FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control_));
+ client_session_control_, protocol::OK));
}
} // namespace
diff --git a/remoting/host/local_input_monitor_unittest.cc b/remoting/host/local_input_monitor_unittest.cc
index b483a0a..8f19af6 100644
--- a/remoting/host/local_input_monitor_unittest.cc
+++ b/remoting/host/local_input_monitor_unittest.cc
@@ -67,7 +67,7 @@ TEST_F(LocalInputMonitorTest, Basic) {
EXPECT_CALL(client_session_control_, client_jid())
.Times(AnyNumber())
.WillRepeatedly(ReturnRef(client_jid_));
- EXPECT_CALL(client_session_control_, DisconnectSession())
+ EXPECT_CALL(client_session_control_, DisconnectSession(_))
.Times(AnyNumber());
EXPECT_CALL(client_session_control_, OnLocalMouseMoved(_))
.Times(AnyNumber());
diff --git a/remoting/host/local_input_monitor_win.cc b/remoting/host/local_input_monitor_win.cc
index 1b92e03..74975ec 100644
--- a/remoting/host/local_input_monitor_win.cc
+++ b/remoting/host/local_input_monitor_win.cc
@@ -133,7 +133,7 @@ void LocalInputMonitorWin::Core::StartOnUiThread() {
// the session. Disconnect the session now to prevent this.
caller_task_runner_->PostTask(
FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control_));
+ client_session_control_, protocol::OK));
}
}
diff --git a/remoting/host/local_input_monitor_x11.cc b/remoting/host/local_input_monitor_x11.cc
index 9e410f8..b515b69 100644
--- a/remoting/host/local_input_monitor_x11.cc
+++ b/remoting/host/local_input_monitor_x11.cc
@@ -300,7 +300,7 @@ void LocalInputMonitorX11::Core::ProcessXEvent(xEvent* event) {
} else if (key_sym == XK_Escape && down && alt_pressed_ && ctrl_pressed_) {
caller_task_runner_->PostTask(
FROM_HERE, base::Bind(&ClientSessionControl::DisconnectSession,
- client_session_control_));
+ client_session_control_, protocol::OK));
}
}
}
diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc
index a689c75..ee58120 100644
--- a/remoting/host/win/worker_process_launcher_unittest.cc
+++ b/remoting/host/win/worker_process_launcher_unittest.cc
@@ -303,8 +303,10 @@ void WorkerProcessLauncherTest::SendToProcess(IPC::Message* message) {
}
void WorkerProcessLauncherTest::SendFakeMessageToLauncher() {
- if (channel_client_)
- channel_client_->Send(new ChromotingDesktopNetworkMsg_DisconnectSession());
+ if (channel_client_) {
+ channel_client_->Send(
+ new ChromotingDesktopNetworkMsg_DisconnectSession(protocol::OK));
+ }
}
void WorkerProcessLauncherTest::CrashWorker() {
diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc
index 18943f4..4cf331b 100644
--- a/remoting/protocol/connection_to_client.cc
+++ b/remoting/protocol/connection_to_client.cc
@@ -36,14 +36,14 @@ protocol::Session* ConnectionToClient::session() {
return session_.get();
}
-void ConnectionToClient::Disconnect() {
+void ConnectionToClient::Disconnect(ErrorCode error) {
DCHECK(CalledOnValidThread());
CloseChannels();
// This should trigger OnConnectionClosed() event and this object
// may be destroyed as the result.
- session_->Close();
+ session_->Close(error);
}
void ConnectionToClient::OnInputEventReceived(int64_t timestamp) {
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index 2425546..5e7bc67 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -79,7 +79,7 @@ class ConnectionToClient : public base::NonThreadSafe,
virtual Session* session();
// Disconnect the client connection.
- virtual void Disconnect();
+ virtual void Disconnect(ErrorCode error);
// Callback for HostEventDispatcher to be called with a timestamp for each
// received event.
diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc
index 0dc9281..8b31a99 100644
--- a/remoting/protocol/connection_to_client_unittest.cc
+++ b/remoting/protocol/connection_to_client_unittest.cc
@@ -81,7 +81,7 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) {
EXPECT_FALSE(channel->written_data().empty());
// And then close the connection to ConnectionToClient.
- viewer_->Disconnect();
+ viewer_->Disconnect(protocol::OK);
base::RunLoop().RunUntilIdle();
}
@@ -91,7 +91,7 @@ TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) {
viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure());
// And then close the connection to ConnectionToClient.
- viewer_->Disconnect();
+ viewer_->Disconnect(protocol::OK);
// The test will crash if data writer tries to write data to the
// channel socket.
diff --git a/remoting/protocol/errors.cc b/remoting/protocol/errors.cc
index 9c92e54..12b0b1d 100644
--- a/remoting/protocol/errors.cc
+++ b/remoting/protocol/errors.cc
@@ -24,6 +24,8 @@ const char* ErrorCodeToString(ErrorCode error) {
RETURN_STRING_LITERAL(SIGNALING_ERROR);
RETURN_STRING_LITERAL(SIGNALING_TIMEOUT);
RETURN_STRING_LITERAL(HOST_OVERLOAD);
+ RETURN_STRING_LITERAL(MAX_SESSION_LENGTH);
+ RETURN_STRING_LITERAL(HOST_CONFIGURATION_ERROR);
RETURN_STRING_LITERAL(UNKNOWN_ERROR);
}
NOTREACHED();
diff --git a/remoting/protocol/errors.h b/remoting/protocol/errors.h
index 4f91e23..4dcf4e9 100644
--- a/remoting/protocol/errors.h
+++ b/remoting/protocol/errors.h
@@ -22,7 +22,11 @@ enum ErrorCode {
SIGNALING_ERROR,
SIGNALING_TIMEOUT,
HOST_OVERLOAD,
+ MAX_SESSION_LENGTH,
+ HOST_CONFIGURATION_ERROR,
UNKNOWN_ERROR,
+
+ ERROR_CODE_MAX = UNKNOWN_ERROR,
};
// Returns the literal string of |error|.
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index 9e7d8fc..046dc8d 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -69,8 +69,9 @@ FakeStreamChannelFactory* FakeSession::GetQuicChannelFactory() {
return transport_session_.GetStreamChannelFactory();
}
-void FakeSession::Close() {
+void FakeSession::Close(ErrorCode error) {
closed_ = true;
+ error_ = error;
}
} // namespace protocol
diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h
index 3ca7fc3..3ed0a3f 100644
--- a/remoting/protocol/fake_session.h
+++ b/remoting/protocol/fake_session.h
@@ -56,7 +56,7 @@ class FakeSession : public Session {
const SessionConfig& config() override;
FakeTransportSession* GetTransportSession() override;
FakeStreamChannelFactory* GetQuicChannelFactory() override;
- void Close() override;
+ void Close(ErrorCode error) override;
public:
EventHandler* event_handler_;
diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc
index bc248e9..2b73007 100644
--- a/remoting/protocol/jingle_messages.cc
+++ b/remoting/protocol/jingle_messages.cc
@@ -43,7 +43,9 @@ const NameMapElement<JingleMessage::Reason> kReasons[] = {
{ JingleMessage::SUCCESS, "success" },
{ JingleMessage::DECLINE, "decline" },
{ JingleMessage::CANCEL, "cancel" },
+ { JingleMessage::EXPIRED, "expired" },
{ JingleMessage::GENERAL_ERROR, "general-error" },
+ { JingleMessage::FAILED_APPLICATION, "failed-application" },
{ JingleMessage::INCOMPATIBLE_PARAMETERS, "incompatible-parameters" },
};
diff --git a/remoting/protocol/jingle_messages.h b/remoting/protocol/jingle_messages.h
index 32b78c1..96a0f48 100644
--- a/remoting/protocol/jingle_messages.h
+++ b/remoting/protocol/jingle_messages.h
@@ -32,7 +32,9 @@ struct JingleMessage {
SUCCESS,
DECLINE,
CANCEL,
+ EXPIRED,
GENERAL_ERROR,
+ FAILED_APPLICATION,
INCOMPATIBLE_PARAMETERS,
};
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 79654d1..f45a47f 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -139,7 +139,7 @@ void JingleSession::InitializeIncomingConnection(
if (!config_) {
LOG(WARNING) << "Rejecting connection from " << peer_jid_
<< " because no compatible configuration has been found.";
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
@@ -147,7 +147,7 @@ void JingleSession::InitializeIncomingConnection(
quic_channel_factory_.reset(new QuicChannelFactory(session_id_, true));
if (!quic_channel_factory_->ProcessSessionInitiateConfigMessage(
initiate_message.description->quic_config_message())) {
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
}
}
@@ -164,7 +164,7 @@ void JingleSession::AcceptIncomingConnection(
initiate_message.description->authenticator_message();
if (!first_auth_message) {
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
@@ -178,8 +178,7 @@ void JingleSession::AcceptIncomingConnection(
void JingleSession::ContinueAcceptIncomingConnection() {
DCHECK_NE(authenticator_->state(), Authenticator::PROCESSING_MESSAGE);
if (authenticator_->state() == Authenticator::REJECTED) {
- CloseInternal(AuthRejectionReasonToErrorCode(
- authenticator_->rejection_reason()));
+ Close(AuthRejectionReasonToErrorCode(authenticator_->rejection_reason()));
return;
}
@@ -232,10 +231,51 @@ StreamChannelFactory* JingleSession::GetQuicChannelFactory() {
return quic_channel_factory_.get();
}
-void JingleSession::Close() {
+void JingleSession::Close(protocol::ErrorCode error) {
DCHECK(CalledOnValidThread());
- CloseInternal(OK);
+ if (is_session_active()) {
+ // Send session-terminate message with the appropriate error code.
+ JingleMessage::Reason reason;
+ switch (error) {
+ case OK:
+ reason = JingleMessage::SUCCESS;
+ break;
+ case SESSION_REJECTED:
+ case AUTHENTICATION_FAILED:
+ reason = JingleMessage::DECLINE;
+ break;
+ case INCOMPATIBLE_PROTOCOL:
+ reason = JingleMessage::INCOMPATIBLE_PARAMETERS;
+ break;
+ case HOST_OVERLOAD:
+ reason = JingleMessage::CANCEL;
+ break;
+ case MAX_SESSION_LENGTH:
+ reason = JingleMessage::EXPIRED;
+ break;
+ case HOST_CONFIGURATION_ERROR:
+ reason = JingleMessage::FAILED_APPLICATION;
+ break;
+ default:
+ reason = JingleMessage::GENERAL_ERROR;
+ }
+
+ JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE,
+ session_id_);
+ message.reason = reason;
+ SendMessage(message);
+ }
+
+ error_ = error;
+
+ if (state_ != FAILED && state_ != CLOSED) {
+ if (error != OK) {
+ SetState(FAILED);
+ } else {
+ SetState(CLOSED);
+ }
+ }
}
void JingleSession::SendMessage(const JingleMessage& message) {
@@ -276,7 +316,7 @@ void JingleSession::OnMessageResponse(
// |response| will be nullptr if the request timed out.
if (!response) {
LOG(ERROR) << type_str << " request timed out.";
- CloseInternal(SIGNALING_TIMEOUT);
+ Close(SIGNALING_TIMEOUT);
return;
} else {
const std::string& type =
@@ -288,7 +328,7 @@ void JingleSession::OnMessageResponse(
// TODO(sergeyu): There may be different reasons for error
// here. Parse the response stanza to find failure reason.
- CloseInternal(PEER_IS_OFFLINE);
+ Close(PEER_IS_OFFLINE);
}
}
}
@@ -315,7 +355,7 @@ void JingleSession::OnTransportRouteChange(const std::string& channel_name,
}
void JingleSession::OnTransportError(ErrorCode error) {
- CloseInternal(error);
+ Close(error);
}
void JingleSession::OnTransportInfoResponse(IqRequest* request,
@@ -344,7 +384,7 @@ void JingleSession::OnTransportInfoResponse(IqRequest* request,
if (type != "result") {
LOG(ERROR) << "Received error in response to transport-info message: \""
<< response->Str() << "\". Terminating the session.";
- CloseInternal(PEER_IS_OFFLINE);
+ Close(PEER_IS_OFFLINE);
}
}
@@ -398,19 +438,19 @@ void JingleSession::OnAccept(const JingleMessage& message,
message.description->authenticator_message();
if (!auth_message) {
DLOG(WARNING) << "Received session-accept without authentication message ";
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
if (!InitializeConfigFromDescription(message.description.get())) {
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
if (config_->is_using_quic()) {
if (!quic_channel_factory_->ProcessSessionAcceptConfigMessage(
message.description->quic_config_message())) {
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
} else {
@@ -437,7 +477,7 @@ void JingleSession::OnSessionInfo(const JingleMessage& message,
LOG(WARNING) << "Received unexpected authenticator message "
<< message.info->Str();
reply_callback.Run(JingleMessageReply::UNEXPECTED_REQUEST);
- CloseInternal(INCOMPATIBLE_PROTOCOL);
+ Close(INCOMPATIBLE_PROTOCOL);
return;
}
@@ -471,12 +511,18 @@ void JingleSession::OnTerminate(const JingleMessage& message,
case JingleMessage::CANCEL:
error_ = HOST_OVERLOAD;
break;
- case JingleMessage::GENERAL_ERROR:
- error_ = CHANNEL_CONNECTION_ERROR;
+ case JingleMessage::EXPIRED:
+ error_ = MAX_SESSION_LENGTH;
break;
case JingleMessage::INCOMPATIBLE_PARAMETERS:
error_ = INCOMPATIBLE_PROTOCOL;
break;
+ case JingleMessage::FAILED_APPLICATION:
+ error_ = HOST_CONFIGURATION_ERROR;
+ break;
+ case JingleMessage::GENERAL_ERROR:
+ error_ = CHANNEL_CONNECTION_ERROR;
+ break;
default:
error_ = UNKNOWN_ERROR;
}
@@ -541,7 +587,7 @@ void JingleSession::ContinueAuthenticationStep() {
if (authenticator_->state() == Authenticator::ACCEPTED) {
OnAuthenticated();
} else if (authenticator_->state() == Authenticator::REJECTED) {
- CloseInternal(AuthRejectionReasonToErrorCode(
+ Close(AuthRejectionReasonToErrorCode(
authenticator_->rejection_reason()));
}
}
@@ -558,47 +604,6 @@ void JingleSession::OnAuthenticated() {
SetState(AUTHENTICATED);
}
-void JingleSession::CloseInternal(ErrorCode error) {
- DCHECK(CalledOnValidThread());
-
- if (is_session_active()) {
- // Send session-terminate message with the appropriate error code.
- JingleMessage::Reason reason;
- switch (error) {
- case OK:
- reason = JingleMessage::SUCCESS;
- break;
- case SESSION_REJECTED:
- case AUTHENTICATION_FAILED:
- reason = JingleMessage::DECLINE;
- break;
- case INCOMPATIBLE_PROTOCOL:
- reason = JingleMessage::INCOMPATIBLE_PARAMETERS;
- break;
- case HOST_OVERLOAD:
- reason = JingleMessage::CANCEL;
- break;
- default:
- reason = JingleMessage::GENERAL_ERROR;
- }
-
- JingleMessage message(peer_jid_, JingleMessage::SESSION_TERMINATE,
- session_id_);
- message.reason = reason;
- SendMessage(message);
- }
-
- error_ = error;
-
- if (state_ != FAILED && state_ != CLOSED) {
- if (error != OK) {
- SetState(FAILED);
- } else {
- SetState(CLOSED);
- }
- }
-}
-
void JingleSession::SetState(State new_state) {
DCHECK(CalledOnValidThread());
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 9e595afe..28b4db9 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -44,7 +44,7 @@ class JingleSession : public base::NonThreadSafe,
const SessionConfig& config() override;
TransportSession* GetTransportSession() override;
StreamChannelFactory* GetQuicChannelFactory() override;
- void Close() override;
+ void Close(protocol::ErrorCode error) override;
private:
friend class JingleSessionManager;
@@ -113,11 +113,6 @@ class JingleSession : public base::NonThreadSafe,
// Called when authentication is finished.
void OnAuthenticated();
- // Terminates the session and sends session-terminate if it is
- // necessary. |error| specifies the error code in case when the
- // session is being closed due to an error.
- void CloseInternal(ErrorCode error);
-
// Sets |state_| to |new_state| and calls state change callback.
void SetState(State new_state);
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index c0a0d8a..d630085 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -141,7 +141,7 @@ bool JingleSessionManager::OnSignalStrategyIncomingStanza(
error = SESSION_REJECTED;
}
- session->CloseInternal(error);
+ session->Close(error);
delete session;
DCHECK(sessions_.find(message.sid) == sessions_.end());
}
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 0e65e84..20e17f6 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -39,7 +39,7 @@ class MockConnectionToClient : public ConnectionToClient {
MOCK_METHOD0(video_stub, VideoStub*());
MOCK_METHOD0(client_stub, ClientStub*());
MOCK_METHOD0(session, Session*());
- MOCK_METHOD0(Disconnect, void());
+ MOCK_METHOD1(Disconnect, void(ErrorCode error));
void set_clipboard_stub(ClipboardStub* clipboard_stub) override {
clipboard_stub_ = clipboard_stub;
@@ -213,7 +213,7 @@ class MockSession : public Session {
MOCK_METHOD1(set_receiver_token, void(const std::string& receiver_token));
MOCK_METHOD1(set_shared_secret, void(const std::string& secret));
MOCK_METHOD0(shared_secret, const std::string&());
- MOCK_METHOD0(Close, void());
+ MOCK_METHOD1(Close, void(ErrorCode error));
private:
DISALLOW_COPY_AND_ASSIGN(MockSession);
diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h
index 4f068f8..de42943 100644
--- a/remoting/protocol/session.h
+++ b/remoting/protocol/session.h
@@ -89,10 +89,10 @@ class Session {
// disabled for the session.
virtual StreamChannelFactory* GetQuicChannelFactory() = 0;
- // Closes connection. Callbacks are guaranteed not to be called
- // after this method returns. Must be called before the object is
- // destroyed, unless the state is set to FAILED or CLOSED.
- virtual void Close() = 0;
+ // Closes connection. Callbacks are guaranteed not to be called after this
+ // method returns. |error| specifies the error code in case when the session
+ // is being closed due to an error.
+ virtual void Close(ErrorCode error) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(Session);
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd
index 46b6998..37102a7 100644
--- a/remoting/resources/remoting_strings.grd
+++ b/remoting/resources/remoting_strings.grd
@@ -731,6 +731,13 @@ For information about privacy, please see the Google Privacy Policy (http://goo.
<message desc="Error that is shown on the client side when the host is blocking all connections due to failed authentication attempts." name="IDS_ERROR_HOST_OVERLOAD" formatter_data="android_java">
Connections to the remote computer are temporarily blocked because somebody was trying to connect to it with invalid PIN. Please try again later.
</message>
+ <message desc="Error that is shown on the client side after the host has terminated connection that lasted more than maximum allowed duration." name="IDS_ERROR_MAX_SESSION_LENGTH" formatter_data="android_java">
+ The remote session has expired.
+ </message>
+ <message desc="Error that is shown on the client side the host has failed to accept the connection due to a configuration issue." name="IDS_ERROR_HOST_CONFIGURATION_ERROR" formatter_data="android_java">
+ The remote computer has failed to initialize the session. If problem persist please try to configure the host again.
+ </message>
+
<message desc="Error that is shown on the client side when we don't get a response from the host." name="IDS_ERROR_HOST_IS_OFFLINE" formatter_data="android_java">
The remote computer is not responding to connection requests. Please verify that it is online and try again.
</message>
diff --git a/remoting/webapp/base/js/chromoting_event.js b/remoting/webapp/base/js/chromoting_event.js
index fad1074..1842e36 100644
--- a/remoting/webapp/base/js/chromoting_event.js
+++ b/remoting/webapp/base/js/chromoting_event.js
@@ -264,6 +264,8 @@ remoting.ChromotingEvent.ConnectionError = {
UNEXPECTED: 13,
CLIENT_SUSPENDED: 14,
NACL_DISABLED: 15,
+ MAX_SESSION_LENGTH: 16,
+ HOST_CONFIGURATION_ERROR: 17,
};
/** @enum {number} */
diff --git a/remoting/webapp/base/js/client_session.js b/remoting/webapp/base/js/client_session.js
index f5bb9ba..7b3f0cb 100644
--- a/remoting/webapp/base/js/client_session.js
+++ b/remoting/webapp/base/js/client_session.js
@@ -178,7 +178,9 @@ remoting.ClientSession.ConnectionError = {
SESSION_REJECTED: 2,
INCOMPATIBLE_PROTOCOL: 3,
NETWORK_FAILURE: 4,
- HOST_OVERLOAD: 5
+ HOST_OVERLOAD: 5,
+ MAX_SESSION_LENGTH: 6,
+ HOST_CONFIGURATION_ERROR: 7
};
/**
@@ -456,24 +458,28 @@ remoting.ClientSession.prototype.onConnectionStatusUpdate =
if (status == remoting.ClientSession.State.FAILED) {
switch (error) {
case remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE:
- this.error_ = new remoting.Error(
- remoting.Error.Tag.HOST_IS_OFFLINE);
+ this.error_ = new remoting.Error(remoting.Error.Tag.HOST_IS_OFFLINE);
break;
case remoting.ClientSession.ConnectionError.SESSION_REJECTED:
- this.error_ = new remoting.Error(
- remoting.Error.Tag.INVALID_ACCESS_CODE);
+ this.error_ =
+ new remoting.Error(remoting.Error.Tag.INVALID_ACCESS_CODE);
break;
case remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL:
- this.error_ = new remoting.Error(
- remoting.Error.Tag.INCOMPATIBLE_PROTOCOL);
+ this.error_ =
+ new remoting.Error(remoting.Error.Tag.INCOMPATIBLE_PROTOCOL);
break;
case remoting.ClientSession.ConnectionError.NETWORK_FAILURE:
- this.error_ = new remoting.Error(
- remoting.Error.Tag.P2P_FAILURE);
+ this.error_ = new remoting.Error(remoting.Error.Tag.P2P_FAILURE);
break;
case remoting.ClientSession.ConnectionError.HOST_OVERLOAD:
- this.error_ = new remoting.Error(
- remoting.Error.Tag.HOST_OVERLOAD);
+ this.error_ = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD);
+ break;
+ case remoting.ClientSession.ConnectionError.MAX_SESSION_LENGTH:
+ this.error_ = new remoting.Error(remoting.Error.Tag.MAX_SESSION_LENGTH);
+ break;
+ case remoting.ClientSession.ConnectionError.HOST_CONFIGURATION_ERROR:
+ this.error_ =
+ new remoting.Error(remoting.Error.Tag.HOST_CONFIGURATION_ERROR);
break;
default:
this.error_ = remoting.Error.unexpected();
diff --git a/remoting/webapp/base/js/error.js b/remoting/webapp/base/js/error.js
index 23ee1f8..697fde7 100644
--- a/remoting/webapp/base/js/error.js
+++ b/remoting/webapp/base/js/error.js
@@ -62,6 +62,10 @@ remoting.Error.prototype.toConnectionError = function() {
return ConnectionError.NETWORK_FAILURE;
case Tag.HOST_OVERLOAD:
return ConnectionError.HOST_OVERLOAD;
+ case Tag.MAX_SESSION_LENGTH:
+ return ConnectionError.MAX_SESSION_LENGTH;
+ case Tag.HOST_CONFIGURATION_ERROR:
+ return ConnectionError.HOST_CONFIGURATION_ERROR;
case Tag.P2P_FAILURE:
return ConnectionError.P2P_FAILURE;
case Tag.NACL_DISABLED:
@@ -170,6 +174,8 @@ remoting.Error.Tag = {
BAD_VERSION: /*i18n-content*/ 'ERROR_BAD_PLUGIN_VERSION',
NETWORK_FAILURE: /*i18n-content*/ 'ERROR_NETWORK_FAILURE',
HOST_OVERLOAD: /*i18n-content*/ 'ERROR_HOST_OVERLOAD',
+ MAX_SESSION_LENGTH: /*i18n-content*/ 'ERROR_MAX_SESSION_LENGTH',
+ HOST_CONFIGURATION_ERROR: /*i18n-content*/ 'ERROR_HOST_CONFIGURATION_ERROR',
UNEXPECTED: /*i18n-content*/ 'ERROR_UNEXPECTED',
SERVICE_UNAVAILABLE: /*i18n-content*/ 'ERROR_SERVICE_UNAVAILABLE',
NOT_AUTHENTICATED: /*i18n-content*/ 'ERROR_NOT_AUTHENTICATED',