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

Unified Diff: remoting/protocol/connection_to_host.cc

Issue 9567033: Cleanup error handling in the client plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/connection_to_host.cc
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index 3e1093360c3ee9640cd629313e7cd878f57a5a9b..10046cb6e3e0716a686baa093c27b57e697f961c 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -16,6 +16,7 @@
#include "remoting/protocol/client_control_dispatcher.h"
#include "remoting/protocol/client_event_dispatcher.h"
#include "remoting/protocol/client_stub.h"
+#include "remoting/protocol/errors.h"
#include "remoting/protocol/jingle_session_manager.h"
#include "remoting/protocol/pepper_transport_factory.h"
#include "remoting/protocol/video_reader.h"
@@ -176,24 +177,18 @@ void ConnectionToHost::OnSessionStateChange(
break;
case Session::FAILED:
- switch (session_->error()) {
- case Session::PEER_IS_OFFLINE:
- CloseOnError(HOST_IS_OFFLINE);
- break;
- case Session::SESSION_REJECTED:
- case Session::AUTHENTICATION_FAILED:
- CloseOnError(SESSION_REJECTED);
- break;
- case Session::INCOMPATIBLE_PROTOCOL:
- CloseOnError(INCOMPATIBLE_PROTOCOL);
- break;
- case Session::CHANNEL_CONNECTION_ERROR:
- case Session::UNKNOWN_ERROR:
- CloseOnError(NETWORK_FAILURE);
- break;
- case Session::OK:
- DLOG(FATAL) << "Error code isn't set";
- CloseOnError(NETWORK_FAILURE);
+ // If we were connected then treat this error as if the
+ // connection was closed by the peer.
+ //
+ // TODO(sergeyu): This logic belongs to the webapp, but we
+ // currently don't expose this error code to the webapp, and it
+ // would hard to add it because client plugin and webapp
+ // versions may not be in sync. It should be easy to do after we
+ // are finished moving the client plugin to NaCl.
Jamie 2012/03/02 00:48:12 Please add a similar comment to ConvertConnectErro
Sergey Ulanov 2012/03/02 01:04:54 Done.
+ if (state_ == CONNECTED || session_->error() == SIGNALING_TIMEOUT) {
+ SetState(CLOSED, OK);
+ } else {
+ CloseOnError(session_->error());
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698