Index: remoting/protocol/jingle_session.cc |
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc |
index bfab845debed86b9f7b98c032acd653953f14679..1dbc92776b0773304cb7d6b2f8d74e6be3566ef0 100644 |
--- a/remoting/protocol/jingle_session.cc |
+++ b/remoting/protocol/jingle_session.cc |
@@ -147,7 +147,13 @@ void JingleSession::AcceptIncomingConnection( |
} |
DCHECK_EQ(authenticator_->state(), Authenticator::WAITING_MESSAGE); |
- authenticator_->ProcessMessage(first_auth_message); |
+ authenticator_->ProcessMessage(base::Bind( |
+ &JingleSession::ContinueAcceptIncomingConnection, |
+ // Authenticator is owned by JingleSession, and cannot outlive it. |
+ base::Unretained(this)), first_auth_message); |
+} |
+ |
+void JingleSession::ContinueAcceptIncomingConnection() { |
Sergey Ulanov
2013/02/28 08:05:16
This change introduces another state that wasn't p
rmsousa
2013/02/28 23:29:23
AcceptIncomingConnection is called after Initializ
|
if (authenticator_->state() == Authenticator::REJECTED) { |
CloseInternal(AuthRejectionReasonToErrorCode( |
authenticator_->rejection_reason())); |
@@ -435,9 +441,6 @@ void JingleSession::OnAccept(const JingleMessage& message, |
return; |
} |
- DCHECK(authenticator_->state() == Authenticator::WAITING_MESSAGE); |
- authenticator_->ProcessMessage(auth_message); |
- |
if (!InitializeConfigFromDescription(message.description.get())) { |
CloseInternal(INCOMPATIBLE_PROTOCOL); |
return; |
@@ -448,12 +451,11 @@ void JingleSession::OnAccept(const JingleMessage& message, |
SetState(CONNECTED); |
- // Process authentication. |
- if (authenticator_->state() == Authenticator::ACCEPTED) { |
- SetState(AUTHENTICATED); |
- } else { |
- ProcessAuthenticationStep(); |
- } |
+ DCHECK(authenticator_->state() == Authenticator::WAITING_MESSAGE); |
+ authenticator_->ProcessMessage(base::Bind( |
+ &JingleSession::ProcessAuthenticationStep, |
+ // Authenticator is owned by JingleSession, and cannot outlive it. |
+ base::Unretained(this)), auth_message); |
} |
void JingleSession::OnSessionInfo(const JingleMessage& message, |
@@ -475,8 +477,10 @@ void JingleSession::OnSessionInfo(const JingleMessage& message, |
reply_callback.Run(JingleMessageReply::NONE); |
- authenticator_->ProcessMessage(message.info.get()); |
- ProcessAuthenticationStep(); |
+ authenticator_->ProcessMessage(base::Bind( |
+ &JingleSession::ProcessAuthenticationStep, |
+ // Authenticator is owned by JingleSession, and cannot outlive it. |
+ base::Unretained(this)), message.info.get()); |
} |
void JingleSession::ProcessTransportInfo(const JingleMessage& message) { |
@@ -550,6 +554,7 @@ bool JingleSession::InitializeConfigFromDescription( |
} |
void JingleSession::ProcessAuthenticationStep() { |
+ DCHECK(CalledOnValidThread()); |
DCHECK_EQ(state_, CONNECTED); |
if (authenticator_->state() == Authenticator::MESSAGE_READY) { |