From 9945260aff5761e1cb99ad3520a507032c01b205 Mon Sep 17 00:00:00 2001 From: "wangkai399@huawei.com" Date: Mon, 25 Apr 2022 20:11:02 +0800 Subject: [PATCH] =?UTF-8?q?IPC=E7=BB=9F=E4=B8=80=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BB=86=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangkai399@huawei.com --- samgr_endpoint/source/default_client_rpc.c | 4 ++-- samgr_endpoint/source/samgr_small_ipc_adapter.c | 16 +++------------- samgr_server/source/samgr_server_rpc.c | 2 +- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/samgr_endpoint/source/default_client_rpc.c b/samgr_endpoint/source/default_client_rpc.c index e1d72d0..30281f8 100755 --- a/samgr_endpoint/source/default_client_rpc.c +++ b/samgr_endpoint/source/default_client_rpc.c @@ -182,11 +182,11 @@ static int ProxyInvoke(IClientProxy *proxy, int funcId, IpcIo *request, IOwner o ProxyInvokeArgInner(&requestWrapper, header); if (!IpcIoAppend(&requestWrapper, request)) { HILOG_ERROR(HILOG_MODULE_SAMGR, "ipc io append fail\n"); - FreeBuffer(data); + free(data); return EC_INVALID; } int ret = SendRequest(header->target, funcId, &requestWrapper, &reply, flag, (uintptr_t *)&replyBuf); - FreeBuffer(data); + free(data); if (notify != NULL) { notify(owner, ret, &reply); diff --git a/samgr_endpoint/source/samgr_small_ipc_adapter.c b/samgr_endpoint/source/samgr_small_ipc_adapter.c index 49ce0a6..d5b5ace 100644 --- a/samgr_endpoint/source/samgr_small_ipc_adapter.c +++ b/samgr_endpoint/source/samgr_small_ipc_adapter.c @@ -90,7 +90,7 @@ void Listen(Endpoint *endpoint, int token, const char *service, const char *feat endpoint->identity.cookie = objectStubOne; //handle must -1 endpoint->identity.handle = INVALID_INDEX; - endpoint->identity.token = 1; + endpoint->identity.token = SERVICE_TYPE_NORMAL; registerEpArg->endpoint = endpoint; registerEpArg->token = token; @@ -185,7 +185,7 @@ int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, ret = -ret; int32_t ipcRet = EC_FAILURE; if (ret == EC_SUCCESS) { - ret = ReadInt32(&reply, &ipcRet); + ReadInt32(&reply, &ipcRet); } if (ipcRet == EC_SUCCESS) { SvcIdentity target; @@ -195,7 +195,7 @@ int RegisterIdentity(const SaName *saName, SvcIdentity *saInfo, if (replyBuf != NULL) { FreeBuffer(replyBuf); } - return ret; + return ipcRet; } static int Dispatch(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option) { @@ -221,17 +221,7 @@ static int Dispatch(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption opti request.msgId = token; request.data = data; request.msgValue = code; -#ifdef LITE_LINUX_BINDER_IPC HandleIpc(&request, &resp); -#else - uint32 *ref = NULL; - int ret = SAMGR_SendSharedDirectRequest(&router->identity, &request, &resp, &ref, HandleIpc); - if (ret != EC_SUCCESS) { - HILOG_ERROR(HILOG_MODULE_SAMGR, "Router[%u] Service<%d, %d> is busy", - token, router->identity.serviceId, router->identity.featureId); - goto ERROR; - } -#endif return EC_SUCCESS; ERROR: return EC_INVALID; diff --git a/samgr_server/source/samgr_server_rpc.c b/samgr_server/source/samgr_server_rpc.c index 75ab2bc..cacde05 100755 --- a/samgr_server/source/samgr_server_rpc.c +++ b/samgr_server/source/samgr_server_rpc.c @@ -575,7 +575,7 @@ void ProcGetAllSysCap(SamgrServer *server, IpcIo *req, IpcIo *reply) if (serviceImpl->isRegister == FALSE) { continue; } - WriteBool(reply, serviceImpl->name); + WriteString(reply, serviceImpl->name); cnt++; } MUTEX_Unlock(server->sysCapMtx); -- Gitee