From f27a0d532ab23377f0f4e1caaa105fab801b1770 Mon Sep 17 00:00:00 2001 From: yangwei Date: Tue, 2 Sep 2025 14:45:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=89=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangwei --- .../src/device_manager_service_impl.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/services/implementation/src/device_manager_service_impl.cpp b/services/implementation/src/device_manager_service_impl.cpp index 23051eb11..6872ee46f 100644 --- a/services/implementation/src/device_manager_service_impl.cpp +++ b/services/implementation/src/device_manager_service_impl.cpp @@ -95,6 +95,10 @@ static bool IsMessageOldVersion(const JsonObject &jsonObject, std::shared_ptr(); } dmVersion = AuthManagerBase::ConvertSrcVersion(dmVersion, edition); + if (dmVersion == "") { + LOGE("dmVersion is empty."); + return false; + } // Assign the physical session version and release the semaphore. session->version_ = dmVersion; @@ -382,6 +386,10 @@ void DeviceManagerServiceImpl::CleanSessionMapByLogicalSessionId(uint64_t logica void DeviceManagerServiceImpl::CleanAuthMgrByLogicalSessionId(uint64_t logicalSessionId) { + if (logicalSessionId == 0 && authMgr_ != nullptr) { + authMgr_->SetTransferReady(true); + authMgr_->ClearSoftbusSessionCallback(); + } uint64_t tokenId = 0; { std::lock_guard tokenIdLock(logicalSessionId2TokenIdMapMtx_); @@ -394,10 +402,6 @@ void DeviceManagerServiceImpl::CleanAuthMgrByLogicalSessionId(uint64_t logicalSe } CleanSessionMapByLogicalSessionId(logicalSessionId); - if (logicalSessionId == 0 && authMgr_ != nullptr) { - authMgr_->SetTransferReady(true); - authMgr_->ClearSoftbusSessionCallback(); - } hiChainAuthConnector_->UnRegisterHiChainAuthCallbackById(logicalSessionId); EraseAuthMgr(tokenId); return; @@ -1198,7 +1202,7 @@ int32_t DeviceManagerServiceImpl::TransferSinkOldAuthMgr(const JsonObject &jsonO int32_t DeviceManagerServiceImpl::TransferOldAuthMgr(int32_t msgType, const JsonObject &jsonObject, std::shared_ptr curSession) { - int ret = DM_OK; + int ret = ERR_DM_FAILED; if ((authMgr_ == nullptr || authMgr_->IsTransferReady()) && (msgType == MSG_TYPE_REQ_ACL_NEGOTIATE || msgType == MSG_TYPE_RESP_ACL_NEGOTIATE)) { if (IsMessageOldVersion(jsonObject, curSession)) { -- Gitee From 3058295693916fdb2f836abef24be0386623bdd2 Mon Sep 17 00:00:00 2001 From: yangwei Date: Tue, 2 Sep 2025 14:56:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=89=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangwei --- services/implementation/src/device_manager_service_impl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/services/implementation/src/device_manager_service_impl.cpp b/services/implementation/src/device_manager_service_impl.cpp index 6872ee46f..e4485dfd5 100644 --- a/services/implementation/src/device_manager_service_impl.cpp +++ b/services/implementation/src/device_manager_service_impl.cpp @@ -1217,7 +1217,6 @@ int32_t DeviceManagerServiceImpl::TransferOldAuthMgr(int32_t msgType, const Json return ret; } - void DeviceManagerServiceImpl::OnBytesReceived(int sessionId, const void *data, unsigned int dataLen) { if (sessionId < 0 || data == nullptr || dataLen <= 0 || dataLen > MAX_DATA_LEN) { -- Gitee