From 0495378c2896fde1db8d5ca79bdfea67fe588e60 Mon Sep 17 00:00:00 2001 From: renguang1116 Date: Tue, 15 Mar 2022 16:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E6=BA=90=E6=A3=80?= =?UTF-8?q?=E8=A7=86=E9=97=AE=E9=A2=98=20Signed-off-by:=20renguang1116=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/authentication/dm_auth_manager.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index 38ec0e93..bb075c5b 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -249,9 +249,8 @@ void DmAuthManager::OnSessionClosed(int32_t sessionId) void DmAuthManager::OnDataReceived(int32_t sessionId, std::string message) { - LOGI("DmAuthManager::OnDataReceived start"); if (authResponseContext_ == nullptr || authMessageProcessor_ == nullptr) { - LOGI("DmAuthManager::OnDataReceived failed, authResponseContext or authMessageProcessor_ is nullptr."); + LOGE("OnDataReceived failed, authResponseContext or authMessageProcessor_ is nullptr."); return; } @@ -259,7 +258,7 @@ void DmAuthManager::OnDataReceived(int32_t sessionId, std::string message) authMessageProcessor_->SetResponseContext(authResponseContext_); int32_t ret = authMessageProcessor_->ParseMessage(message); if (ret != DM_OK) { - LOGE("OnDataReceived, parse message error"); + LOGE("OnDataReceived failed, parse input message error."); return; } @@ -267,19 +266,18 @@ void DmAuthManager::OnDataReceived(int32_t sessionId, std::string message) // source device auth process authRequestContext_ = authMessageProcessor_->GetRequestContext(); authRequestState_->SetAuthContext(authRequestContext_); + LOGI("OnDataReceived for source device, authResponseContext msgType=%d, authRequestState stateType=%d", + authResponseContext_->msgType, authRequestState_->GetStateType()); + switch (authResponseContext_->msgType) { case MSG_TYPE_RESP_AUTH: if (authRequestState_->GetStateType() == AuthState::AUTH_REQUEST_NEGOTIATE_DONE) { authRequestState_->TransitionTo(std::make_shared()); - } else { - LOGE("Device manager auth state error"); } break; case MSG_TYPE_RESP_NEGOTIATE: if (authRequestState_->GetStateType() == AuthState::AUTH_REQUEST_NEGOTIATE) { authRequestState_->TransitionTo(std::make_shared()); - } else { - LOGE("Device manager auth state error"); } break; case MSG_TYPE_REQ_AUTH_TERMINATE: @@ -295,6 +293,9 @@ void DmAuthManager::OnDataReceived(int32_t sessionId, std::string message) } else if ((authResponseState_ != nullptr) && (authRequestState_ == nullptr)) { // sink device auth process authResponseState_->SetAuthContext(authResponseContext_); + LOGI("OnDataReceived for sink device, authResponseContext msgType=%d, authResponseState stateType=%d", + authResponseContext_->msgType, authResponseState_->GetStateType()); + switch (authResponseContext_->msgType) { case MSG_TYPE_NEGOTIATE: if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_INIT