From f14c20226ed6dbf3509e24728fb9262d7f008a17 Mon Sep 17 00:00:00 2001 From: zengsiyu Date: Thu, 26 Dec 2024 21:00:25 +0800 Subject: [PATCH] cherry pick e5eec9a from https://gitee.com/zengsiyu3/security_access_token/pulls/2716 GetUserAppKey return empty list when ipc failed Signed-off-by: zengsiyu Change-Id: I8a0085689fafe2f8860cefc65f4cdca6fce47d77 --- .../el5filekeymanager/include/el5_filekey_manager_client.h | 2 +- .../el5filekeymanager/src/el5_filekey_manager_client.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/innerkits/el5filekeymanager/include/el5_filekey_manager_client.h b/interfaces/innerkits/el5filekeymanager/include/el5_filekey_manager_client.h index 4a1d23f05..7c20df1cb 100644 --- a/interfaces/innerkits/el5filekeymanager/include/el5_filekey_manager_client.h +++ b/interfaces/innerkits/el5filekeymanager/include/el5_filekey_manager_client.h @@ -37,7 +37,7 @@ public: int32_t SetFilePathPolicy(); int32_t RegisterCallback(const sptr &callback); int32_t CallProxyWithRetry(const std::function &)> &func, - const char *funcName); + const char *funcName, int32_t def = EFM_ERR_REMOTE_CONNECTION); bool IsRequestNeedRetry(int32_t ret); private: diff --git a/interfaces/innerkits/el5filekeymanager/src/el5_filekey_manager_client.cpp b/interfaces/innerkits/el5filekeymanager/src/el5_filekey_manager_client.cpp index c1290c878..6ae66a47c 100644 --- a/interfaces/innerkits/el5filekeymanager/src/el5_filekey_manager_client.cpp +++ b/interfaces/innerkits/el5filekeymanager/src/el5_filekey_manager_client.cpp @@ -80,7 +80,7 @@ int32_t El5FilekeyManagerClient::GetUserAppKey(int32_t userId, bool getAllFlag, std::function &)> func = [&](sptr &proxy) { return proxy->GetUserAppKey(userId, getAllFlag, keyInfos); }; - return CallProxyWithRetry(func, __FUNCTION__); + return CallProxyWithRetry(func, __FUNCTION__, EFM_SUCCESS); } int32_t El5FilekeyManagerClient::ChangeUserAppkeysLoadInfo(int32_t userId, @@ -137,7 +137,7 @@ sptr El5FilekeyManagerClient::GetProxy() } int32_t El5FilekeyManagerClient::CallProxyWithRetry( - const std::function &)> &func, const char *funcName) + const std::function &)> &func, const char *funcName, int32_t def) { LOG_INFO("call proxy with retry function:%s", funcName); auto proxy = GetProxy(); @@ -164,7 +164,7 @@ int32_t El5FilekeyManagerClient::CallProxyWithRetry( LOG_WARN("Call %{public}s failed, retry time = %{public}d, result = %{public}d", funcName, i, ret); } LOG_ERROR("Retry call service %{public}s error, tried %{public}d times.", funcName, SA_REQUEST_RETRY_TIMES); - return EFM_ERR_REMOTE_CONNECTION; + return def; } bool El5FilekeyManagerClient::IsRequestNeedRetry(int32_t ret) -- Gitee