diff options
author | rjkroege <rjkroege@chromium.org> | 2015-10-30 17:18:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-31 00:19:32 +0000 |
commit | 8078f90cf463450c215e1ec898e9a152b570e8d8 (patch) | |
tree | 129902e4bea9cc695392e98a6481ced962ebf974 /remoting | |
parent | a6532be564b7c01e007b98e64b570d34009b34f9 (diff) | |
download | chromium_src-8078f90cf463450c215e1ec898e9a152b570e8d8.zip chromium_src-8078f90cf463450c215e1ec898e9a152b570e8d8.tar.gz chromium_src-8078f90cf463450c215e1ec898e9a152b570e8d8.tar.bz2 |
Revert of Fix chromoting host to report error when closing connection. (patchset #4 id:60001 of https://codereview.chromium.org/1430503002/ )
Reason for revert:
This change would appear to have broken the Mac build:
AILED: /b/build/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/remoting/host/remoting_me2me_host_static.curtain_mode_mac.o.d -DBINARY_CORE=1 -DBINARY_DESKTOP=2 -DBINARY_HOST_ME2ME=3 -DBINARY_NATIVE_MESSAGING_HOST=4 -DBINARY_REMOTE_ASSISTANCE_HOST=5 -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORE=0 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=247874-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_WEBRTC=1 -DENABLE_MEDIA_ROUTER=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DFIELDTRIAL_TESTING_ENABLED -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PDF=1 -DENABLE_PLUGIN_INSTALLATION=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DUSE_BROWSER_SPELLCHECKER=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_SERVICE_DISCOVERY=1 -DENABLE_WIFI_BOOTSTRAPPING=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DVERSION=48.0.2551.0 -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DU_STATIC_IMPLEMENTATION -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_MAC -DWEBRTC_POSIX -DPROTOBUF_USE_DLLS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DFEATURE_ENABLE_SSL -DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DGTEST_RELATIVE_PATH -DNO_MAIN_THREAD_WRAPPING -DNO_SOUND_SYSTEM -DOSX -DXML_STATIC -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_FORTIFY_SOURCE=2 -I../.. -Igen -I../../third_party/khronos -I../../gpu -I../../skia/config -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -Igen/policy -Igen/protoc_out -I../../third_party/webrtc_overrides -I../../third_party -I../../third_party/protobuf -I../../third_party/protobuf/src -I../../third_party/libjingle/overrides -I../../third_party/libjingle/source -I../../testing/gtest/include -I../../third_party/expat/files/lib -isysroot /Applications/Xcode5.1.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -O2 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -mmacosx-version-min=10.6 -arch x86_64 -Wall -Wendif-labels -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-selector-type-mismatch -Wpartial-availability -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-bitfield-width -Wexit-time-destructors -std=c++11 -stdlib=libc++ -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load -Xclang /b/build/slave/Mac/build/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-templates -fcolor-diagnostics -fno-strict-aliasing -c ../../remoting/host/curtain_mode_mac.cc -o obj/remoting/host/remoting_me2me_host_static.curtain_mode_mac.o
../../remoting/host/curtain_mode_mac.cc:212:48: error: too few arguments to function call, single argument 'error' was not specified
client_session_control_->DisconnectSession();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
../../remoting/host/client_session_control.h:29:3: note: 'DisconnectSession' declared here
virtual void DisconnectSession(protocol::ErrorCode error) = 0;
^
1 error generated.
ninja: build stopped: subcommand failed.
http://build.chromium.org/p/chromium/builders/Mac/builds/8747
Original issue's description:
> 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
>
> Committed: https://crrev.com/09750216bef8bc9f2953e4eee9f66801bf034fa4
> Cr-Commit-Position: refs/heads/master@{#357215}
TBR=kelvinp@chromium.org,tsepez@chromium.org,sergeyu@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=548261
Review URL: https://codereview.chromium.org/1424403002
Cr-Commit-Position: refs/heads/master@{#357238}
Diffstat (limited to 'remoting')
46 files changed, 145 insertions, 193 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 5e4cd5e..f5b9498 100644 --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java @@ -77,9 +77,7 @@ 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), - 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); + UNKNOWN_ERROR(9, 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 eef2a20..d29b608 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -120,12 +120,6 @@ 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 ff85892..b2bd1f9 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(protocol::OK); + clients_.front()->DisconnectSession(); } // 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(protocol::HOST_OVERLOAD); + client->DisconnectSession(); 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(protocol::OK); + other_client->DisconnectSession(); } // 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(protocol::OK); + clients_.front()->DisconnectSession(); CHECK_EQ(clients_.size(), size - 1); } } diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc index 6cbc4ea..0eeac1b 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 793156b..3a27b38 100644 --- a/remoting/host/chromoting_messages.h +++ b/remoting/host/chromoting_messages.h @@ -9,7 +9,6 @@ #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" @@ -181,12 +180,8 @@ 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_CONTROL1(ChromotingDesktopNetworkMsg_DisconnectSession, - remoting::protocol::ErrorCode /* error */) +IPC_MESSAGE_CONTROL0(ChromotingDesktopNetworkMsg_DisconnectSession) // 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 1008589..1ddfd38 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()) { - max_duration_timer_.Start( - FROM_HERE, max_duration_, - base::Bind(&ClientSession::DisconnectSession, base::Unretained(this), - protocol::MAX_SESSION_LENGTH)); + // 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); } // Disconnect the session if the connection was rejected by the host. if (!event_handler_->OnSessionAuthenticated(this)) { - DisconnectSession(protocol::SESSION_REJECTED); + DisconnectSession(); return; } @@ -305,7 +305,8 @@ void ClientSession::OnConnectionAuthenticated( desktop_environment_ = desktop_environment_factory_->Create(weak_factory_.GetWeakPtr()); if (!desktop_environment_) { - DisconnectSession(protocol::HOST_CONFIGURATION_ERROR); + // TODO(sergeyu): Fix the host to return an error code (crbug.com/543334). + DisconnectSession(); return; } @@ -427,7 +428,7 @@ const std::string& ClientSession::client_jid() const { return client_jid_; } -void ClientSession::DisconnectSession(protocol::ErrorCode error) { +void ClientSession::DisconnectSession() { DCHECK(CalledOnValidThread()); DCHECK(connection_.get()); @@ -435,7 +436,7 @@ void ClientSession::DisconnectSession(protocol::ErrorCode error) { // This triggers OnConnectionClosed(), and the session may be destroyed // as the result, so this call must be the last in this method. - connection_->Disconnect(error); + connection_->Disconnect(); } void ClientSession::OnLocalMouseMoved(const webrtc::DesktopVector& position) { diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 348552d..d41e83e 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(protocol::ErrorCode error) override; + void DisconnectSession() 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 47d2089..30cb15b 100644 --- a/remoting/host/client_session_control.h +++ b/remoting/host/client_session_control.h @@ -6,7 +6,6 @@ #define REMOTING_HOST_CLIENT_SESSION_CONTROL_H_ #include "base/basictypes.h" -#include "remoting/protocol/errors.h" namespace webrtc { class DesktopVector; @@ -26,7 +25,7 @@ class ClientSessionControl { // Disconnects the client session, tears down transport resources and stops // scheduler components. - virtual void DisconnectSession(protocol::ErrorCode error) = 0; + virtual void DisconnectSession() = 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 81a3b6f..696f83f 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(protocol::OK); + client_session_->DisconnectSession(); // 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(protocol::OK); + client_session_->DisconnectSession(); client_session_->OnConnectionClosed(connection_, protocol::OK); client_session_.reset(); } diff --git a/remoting/host/continue_window.cc b/remoting/host/continue_window.cc index 9871591..35a7f90 100644 --- a/remoting/host/continue_window.cc +++ b/remoting/host/continue_window.cc @@ -54,10 +54,11 @@ void ContinueWindow::DisconnectSession() { disconnect_timer_.Stop(); if (client_session_control_.get()) - client_session_control_->DisconnectSession(protocol::MAX_SESSION_LENGTH); + client_session_control_->DisconnectSession(); } -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 23d05f2..840d588 100644 --- a/remoting/host/desktop_session_agent.cc +++ b/remoting/host/desktop_session_agent.cc @@ -24,7 +24,6 @@ #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" @@ -223,8 +222,8 @@ const std::string& DesktopSessionAgent::client_jid() const { return client_jid_; } -void DesktopSessionAgent::DisconnectSession(protocol::ErrorCode error) { - SendToNetwork(new ChromotingDesktopNetworkMsg_DisconnectSession(error)); +void DesktopSessionAgent::DisconnectSession() { + SendToNetwork(new ChromotingDesktopNetworkMsg_DisconnectSession()); } void DesktopSessionAgent::OnLocalMouseMoved( diff --git a/remoting/host/desktop_session_agent.h b/remoting/host/desktop_session_agent.h index 8f407d1..9d6c4e0 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(protocol::ErrorCode error) override; + void DisconnectSession() 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 4536500..27e8af6 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(protocol::ErrorCode error) { +void DesktopSessionProxy::DisconnectSession() { 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(error); + client_session_control_->DisconnectSession(); } void DesktopSessionProxy::InjectClipboardEvent( diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h index 7ebf6e8..bae2a80 100644 --- a/remoting/host/desktop_session_proxy.h +++ b/remoting/host/desktop_session_proxy.h @@ -20,7 +20,6 @@ #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 { @@ -102,7 +101,7 @@ class DesktopSessionProxy void DetachFromDesktop(); // Disconnects the client session that owns |this|. - void DisconnectSession(protocol::ErrorCode error); + void DisconnectSession(); // 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 981e3f6..d2f8c01 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, protocol::OK), + client_session_control), helper_name); } diff --git a/remoting/host/disconnect_window_linux.cc b/remoting/host/disconnect_window_linux.cc index 0d9fae1..b913ea5 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(protocol::OK); + client_session_control_->DisconnectSession(); } 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(protocol::OK); + client_session_control_->DisconnectSession(); return TRUE; } diff --git a/remoting/host/disconnect_window_mac.mm b/remoting/host/disconnect_window_mac.mm index 06c9762..623c3af 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, protocol::OK); + client_session_control); 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 dff48cec..c0a7ecc 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(protocol::OK); + client_session_control_->DisconnectSession(); } // Returns |control| rectangle in the dialog coordinates. diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h index eaae574..d4462c8 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_METHOD1(DisconnectSession, void(protocol::ErrorCode error)); + MOCK_METHOD0(DisconnectSession, void()); 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 e5be616..bdaf519 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(protocol::ErrorCode error) override; + void DisconnectSession() 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(protocol::ErrorCode error) { +void HostWindowProxy::Core::DisconnectSession() { if (!caller_task_runner_->BelongsToCurrentThread()) { - caller_task_runner_->PostTask( - FROM_HERE, base::Bind(&Core::DisconnectSession, this, error)); + caller_task_runner_->PostTask(FROM_HERE, + base::Bind(&Core::DisconnectSession, this)); return; } if (client_session_control_.get()) - client_session_control_->DisconnectSession(error); + client_session_control_->DisconnectSession(); } void HostWindowProxy::Core::OnLocalMouseMoved( diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc index cc6417e..37bd89f 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(protocol::OK); + desktop_session_proxy->DisconnectSession(); } } diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index 1de0f29..9bfb621 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(InvokeWithoutArgs( + .WillRepeatedly(Invoke( 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 1594f87..dab02e5 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_, protocol::OK)); + client_session_control_)); } } diff --git a/remoting/host/local_input_monitor_mac.mm b/remoting/host/local_input_monitor_mac.mm index 1388877..e3bd3d5 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_, protocol::OK)); + client_session_control_)); } } // namespace diff --git a/remoting/host/local_input_monitor_unittest.cc b/remoting/host/local_input_monitor_unittest.cc index 8f19af6..b483a0a 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 74975ec..1b92e03 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_, protocol::OK)); + client_session_control_)); } } diff --git a/remoting/host/local_input_monitor_x11.cc b/remoting/host/local_input_monitor_x11.cc index b515b69..9e410f8 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_, protocol::OK)); + client_session_control_)); } } } diff --git a/remoting/host/win/worker_process_launcher_unittest.cc b/remoting/host/win/worker_process_launcher_unittest.cc index ee58120..a689c75 100644 --- a/remoting/host/win/worker_process_launcher_unittest.cc +++ b/remoting/host/win/worker_process_launcher_unittest.cc @@ -303,10 +303,8 @@ void WorkerProcessLauncherTest::SendToProcess(IPC::Message* message) { } void WorkerProcessLauncherTest::SendFakeMessageToLauncher() { - if (channel_client_) { - channel_client_->Send( - new ChromotingDesktopNetworkMsg_DisconnectSession(protocol::OK)); - } + if (channel_client_) + channel_client_->Send(new ChromotingDesktopNetworkMsg_DisconnectSession()); } void WorkerProcessLauncherTest::CrashWorker() { diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc index 4cf331b..18943f4 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(ErrorCode error) { +void ConnectionToClient::Disconnect() { DCHECK(CalledOnValidThread()); CloseChannels(); // This should trigger OnConnectionClosed() event and this object // may be destroyed as the result. - session_->Close(error); + session_->Close(); } void ConnectionToClient::OnInputEventReceived(int64_t timestamp) { diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h index 5e7bc67..2425546 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(ErrorCode error); + virtual void Disconnect(); // 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 8b31a99..0dc9281 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(protocol::OK); + viewer_->Disconnect(); 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(protocol::OK); + viewer_->Disconnect(); // 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 12b0b1d..9c92e54 100644 --- a/remoting/protocol/errors.cc +++ b/remoting/protocol/errors.cc @@ -24,8 +24,6 @@ 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 4dcf4e9..4f91e23 100644 --- a/remoting/protocol/errors.h +++ b/remoting/protocol/errors.h @@ -22,11 +22,7 @@ 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 046dc8d..9e7d8fc 100644 --- a/remoting/protocol/fake_session.cc +++ b/remoting/protocol/fake_session.cc @@ -69,9 +69,8 @@ FakeStreamChannelFactory* FakeSession::GetQuicChannelFactory() { return transport_session_.GetStreamChannelFactory(); } -void FakeSession::Close(ErrorCode error) { +void FakeSession::Close() { closed_ = true; - error_ = error; } } // namespace protocol diff --git a/remoting/protocol/fake_session.h b/remoting/protocol/fake_session.h index 3ed0a3f..3ca7fc3 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(ErrorCode error) override; + void Close() override; public: EventHandler* event_handler_; diff --git a/remoting/protocol/jingle_messages.cc b/remoting/protocol/jingle_messages.cc index 2b73007..bc248e9 100644 --- a/remoting/protocol/jingle_messages.cc +++ b/remoting/protocol/jingle_messages.cc @@ -43,9 +43,7 @@ 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 96a0f48..32b78c1 100644 --- a/remoting/protocol/jingle_messages.h +++ b/remoting/protocol/jingle_messages.h @@ -32,9 +32,7 @@ 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 f45a47f..79654d1 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."; - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(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())) { - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); } } @@ -164,7 +164,7 @@ void JingleSession::AcceptIncomingConnection( initiate_message.description->authenticator_message(); if (!first_auth_message) { - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); return; } @@ -178,7 +178,8 @@ void JingleSession::AcceptIncomingConnection( void JingleSession::ContinueAcceptIncomingConnection() { DCHECK_NE(authenticator_->state(), Authenticator::PROCESSING_MESSAGE); if (authenticator_->state() == Authenticator::REJECTED) { - Close(AuthRejectionReasonToErrorCode(authenticator_->rejection_reason())); + CloseInternal(AuthRejectionReasonToErrorCode( + authenticator_->rejection_reason())); return; } @@ -231,51 +232,10 @@ StreamChannelFactory* JingleSession::GetQuicChannelFactory() { return quic_channel_factory_.get(); } -void JingleSession::Close(protocol::ErrorCode error) { +void JingleSession::Close() { 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; - 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); - } - } + CloseInternal(OK); } void JingleSession::SendMessage(const JingleMessage& message) { @@ -316,7 +276,7 @@ void JingleSession::OnMessageResponse( // |response| will be nullptr if the request timed out. if (!response) { LOG(ERROR) << type_str << " request timed out."; - Close(SIGNALING_TIMEOUT); + CloseInternal(SIGNALING_TIMEOUT); return; } else { const std::string& type = @@ -328,7 +288,7 @@ void JingleSession::OnMessageResponse( // TODO(sergeyu): There may be different reasons for error // here. Parse the response stanza to find failure reason. - Close(PEER_IS_OFFLINE); + CloseInternal(PEER_IS_OFFLINE); } } } @@ -355,7 +315,7 @@ void JingleSession::OnTransportRouteChange(const std::string& channel_name, } void JingleSession::OnTransportError(ErrorCode error) { - Close(error); + CloseInternal(error); } void JingleSession::OnTransportInfoResponse(IqRequest* request, @@ -384,7 +344,7 @@ void JingleSession::OnTransportInfoResponse(IqRequest* request, if (type != "result") { LOG(ERROR) << "Received error in response to transport-info message: \"" << response->Str() << "\". Terminating the session."; - Close(PEER_IS_OFFLINE); + CloseInternal(PEER_IS_OFFLINE); } } @@ -438,19 +398,19 @@ void JingleSession::OnAccept(const JingleMessage& message, message.description->authenticator_message(); if (!auth_message) { DLOG(WARNING) << "Received session-accept without authentication message "; - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); return; } if (!InitializeConfigFromDescription(message.description.get())) { - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); return; } if (config_->is_using_quic()) { if (!quic_channel_factory_->ProcessSessionAcceptConfigMessage( message.description->quic_config_message())) { - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); return; } } else { @@ -477,7 +437,7 @@ void JingleSession::OnSessionInfo(const JingleMessage& message, LOG(WARNING) << "Received unexpected authenticator message " << message.info->Str(); reply_callback.Run(JingleMessageReply::UNEXPECTED_REQUEST); - Close(INCOMPATIBLE_PROTOCOL); + CloseInternal(INCOMPATIBLE_PROTOCOL); return; } @@ -511,18 +471,12 @@ void JingleSession::OnTerminate(const JingleMessage& message, case JingleMessage::CANCEL: error_ = HOST_OVERLOAD; break; - case JingleMessage::EXPIRED: - error_ = MAX_SESSION_LENGTH; + case JingleMessage::GENERAL_ERROR: + error_ = CHANNEL_CONNECTION_ERROR; 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; } @@ -587,7 +541,7 @@ void JingleSession::ContinueAuthenticationStep() { if (authenticator_->state() == Authenticator::ACCEPTED) { OnAuthenticated(); } else if (authenticator_->state() == Authenticator::REJECTED) { - Close(AuthRejectionReasonToErrorCode( + CloseInternal(AuthRejectionReasonToErrorCode( authenticator_->rejection_reason())); } } @@ -604,6 +558,47 @@ 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 28b4db9..9e595afe 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(protocol::ErrorCode error) override; + void Close() override; private: friend class JingleSessionManager; @@ -113,6 +113,11 @@ 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 d630085..c0a0d8a 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->Close(error); + session->CloseInternal(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 20e17f6..0e65e84 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_METHOD1(Disconnect, void(ErrorCode error)); + MOCK_METHOD0(Disconnect, void()); 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_METHOD1(Close, void(ErrorCode error)); + MOCK_METHOD0(Close, void()); private: DISALLOW_COPY_AND_ASSIGN(MockSession); diff --git a/remoting/protocol/session.h b/remoting/protocol/session.h index de42943..4f068f8 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. |error| specifies the error code in case when the session - // is being closed due to an error. - virtual void Close(ErrorCode error) = 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; private: DISALLOW_COPY_AND_ASSIGN(Session); diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index 37102a7..46b6998 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -731,13 +731,6 @@ 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 1842e36..fad1074 100644 --- a/remoting/webapp/base/js/chromoting_event.js +++ b/remoting/webapp/base/js/chromoting_event.js @@ -264,8 +264,6 @@ 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 7b3f0cb..f5bb9ba 100644 --- a/remoting/webapp/base/js/client_session.js +++ b/remoting/webapp/base/js/client_session.js @@ -178,9 +178,7 @@ remoting.ClientSession.ConnectionError = { SESSION_REJECTED: 2, INCOMPATIBLE_PROTOCOL: 3, NETWORK_FAILURE: 4, - HOST_OVERLOAD: 5, - MAX_SESSION_LENGTH: 6, - HOST_CONFIGURATION_ERROR: 7 + HOST_OVERLOAD: 5 }; /** @@ -458,28 +456,24 @@ 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); - 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); + this.error_ = new remoting.Error( + remoting.Error.Tag.HOST_OVERLOAD); break; default: this.error_ = remoting.Error.unexpected(); diff --git a/remoting/webapp/base/js/error.js b/remoting/webapp/base/js/error.js index 697fde7..23ee1f8 100644 --- a/remoting/webapp/base/js/error.js +++ b/remoting/webapp/base/js/error.js @@ -62,10 +62,6 @@ 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: @@ -174,8 +170,6 @@ 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', |