Commit 8fbaaa3b authored by sergeyu's avatar sergeyu Committed by Commit bot

Fix JingleSession class to avoid bogus incompatible protocol error

Two issues fixed in the error message handling code:
 1. Error response to session-info message is interpreted as old peer
    that doesn't support current auth protocol. That's not necessary
    anymore.
 2. Errors received after session-terminate were not ignored as they
    should.

BUG=402735

Review URL: https://codereview.chromium.org/493573002

Cr-Commit-Position: refs/heads/master@{#291730}
parent 48c29f23
...@@ -343,12 +343,16 @@ void JingleSession::OnMessageResponse( ...@@ -343,12 +343,16 @@ void JingleSession::OnMessageResponse(
JingleMessage::ActionType request_type, JingleMessage::ActionType request_type,
IqRequest* request, IqRequest* request,
const buzz::XmlElement* response) { const buzz::XmlElement* response) {
std::string type_str = JingleMessage::GetActionName(request_type);
// Delete the request from the list of pending requests. // Delete the request from the list of pending requests.
pending_requests_.erase(request); pending_requests_.erase(request);
delete request; delete request;
// Ignore all responses after session was closed.
if (state_ == CLOSED || state_ == FAILED)
return;
std::string type_str = JingleMessage::GetActionName(request_type);
// |response| will be NULL if the request timed out. // |response| will be NULL if the request timed out.
if (!response) { if (!response) {
LOG(ERROR) << type_str << " request timed out."; LOG(ERROR) << type_str << " request timed out.";
...@@ -362,18 +366,9 @@ void JingleSession::OnMessageResponse( ...@@ -362,18 +366,9 @@ void JingleSession::OnMessageResponse(
<< " message: \"" << response->Str() << " message: \"" << response->Str()
<< "\". Terminating the session."; << "\". Terminating the session.";
switch (request_type) { // TODO(sergeyu): There may be different reasons for error
case JingleMessage::SESSION_INFO: // here. Parse the response stanza to find failure reason.
// session-info is used for the new authentication protocol, CloseInternal(PEER_IS_OFFLINE);
// and wasn't previously supported.
CloseInternal(INCOMPATIBLE_PROTOCOL);
break;
default:
// TODO(sergeyu): There may be different reasons for error
// here. Parse the response stanza to find failure reason.
CloseInternal(PEER_IS_OFFLINE);
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment