Chromium Code Reviews| Index: remoting/protocol/jingle_session.cc |
| diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
| index 8a24662699779189f62a957cdc984fa73d5ab6e0..b95c252ac136211fbdb02f467a337539502b21cc 100644 |
| --- a/remoting/protocol/jingle_session.cc |
| +++ b/remoting/protocol/jingle_session.cc |
| @@ -240,18 +240,21 @@ void JingleSession::Close(protocol::ErrorCode error) { |
| if (is_session_active()) { |
| // Send session-terminate message with the appropriate error code. |
| JingleMessage::Reason reason; |
| + JingleMessage::ErrorCode error_code = JingleMessage::ErrorCode::UNKNOWN; |
| switch (error) { |
| case OK: |
| reason = JingleMessage::SUCCESS; |
| break; |
| case SESSION_REJECTED: |
| + reason = JingleMessage::DECLINE; |
| + error_code = JingleMessage::ErrorCode::SESSION_REJECTED; |
| case AUTHENTICATION_FAILED: |
| reason = JingleMessage::DECLINE; |
| + error_code = JingleMessage::ErrorCode::AUTHENTICATION_FAILED; |
| break; |
| case INVALID_ACCOUNT: |
| - // TODO(zijiehe): Instead of using SECURITY_ERROR Jingle reason, add a |
| - // new tag under crd namespace to export detail error reason to client. |
| - reason = JingleMessage::SECURITY_ERROR; |
| + reason = JingleMessage::DECLINE; |
| + error_code = JingleMessage::ErrorCode::INVALID_ACCOUNT; |
| break; |
| case INCOMPATIBLE_PROTOCOL: |
| reason = JingleMessage::INCOMPATIBLE_PARAMETERS; |
| @@ -272,6 +275,7 @@ void JingleSession::Close(protocol::ErrorCode error) { |
| JingleMessage message(peer_address_, JingleMessage::SESSION_TERMINATE, |
| session_id_); |
| message.reason = reason; |
| + message.error_code = error_code; |
| SendMessage(message); |
| } |
| @@ -490,10 +494,21 @@ void JingleSession::OnTerminate(const JingleMessage& message, |
| } |
| break; |
| case JingleMessage::DECLINE: |
| - error_ = AUTHENTICATION_FAILED; |
| - break; |
| - case JingleMessage::SECURITY_ERROR: |
| - error_ = INVALID_ACCOUNT; |
| + switch (message.error_code) { |
|
Sergey Ulanov
2016/06/01 08:52:47
I think we should use the <error-code> for any rea
Hzj_jie
2016/06/01 23:56:13
Done.
|
| + case JingleMessage::ErrorCode::SESSION_REJECTED: |
| + // For backward compatibility, we still use AUTHENTICATION_FAILED for |
| + // SESSION_REJECTED error. |
| + error_ = AUTHENTICATION_FAILED; |
| + break; |
| + case JingleMessage::ErrorCode::AUTHENTICATION_FAILED: |
| + error_ = AUTHENTICATION_FAILED; |
| + break; |
| + case JingleMessage::ErrorCode::INVALID_ACCOUNT: |
| + error_ = INVALID_ACCOUNT; |
| + break; |
| + default: |
| + error_ = UNKNOWN_ERROR; |
| + } |
| break; |
| case JingleMessage::CANCEL: |
| error_ = HOST_OVERLOAD; |