同步ipc接口切换修改

Signed-off-by: laiguizhong <laiguizhong@huawei.com>
This commit is contained in:
laiguizhong 2022-05-11 14:58:27 +08:00
parent 55700a6e97
commit fd927689e4
3 changed files with 8 additions and 22 deletions

View File

@ -57,7 +57,7 @@ executable("appspawn") {
"${aafwk_lite_path}/frameworks/ability_lite:aafwk_abilitykit_lite",
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
"//build/lite/config/component/cJSON:cjson_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//third_party/bounds_checking_function:libsec_shared",
"//utils/native/lite/kv_store:kv_store",

View File

@ -85,29 +85,15 @@ static int GetMessageSt(MessageSt *msgSt, IpcIo *req)
if (msgSt == NULL || req == NULL) {
return EC_FAILURE;
}
#ifdef __LINUX__
size_t len = 0;
char *str = IpcIoPopString(req, &len);
char* str = ReadString(req, &len);
if (str == NULL || len == 0) {
APPSPAWN_LOGE("[appspawn] invoke, get data failed.");
return EC_FAILURE;
}
int ret = SplitMessage(str, len, msgSt); // after split message, str no need to free(linux version)
#else
BuffPtr *dataPtr = IpcIoPopDataBuff(req);
if (dataPtr == NULL) {
APPSPAWN_LOGE("[appspawn] invoke, get data failed.");
return EC_FAILURE;
}
int ret = SplitMessage((char *)dataPtr->buff, dataPtr->buffSz, msgSt);
// release buffer
if (FreeBuffer(NULL, dataPtr->buff) != LITEIPC_OK) {
APPSPAWN_LOGE("[appspawn] invoke, free buffer failed!");
}
#endif
return ret;
}
@ -140,7 +126,7 @@ static int Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, Ip
if (reply == NULL || funcId != ID_CALL_CREATE_SERVICE || req == NULL) {
APPSPAWN_LOGE("[appspawn] invoke, funcId %d invalid, reply %d.", funcId, INVALID_PID);
IpcIoPushInt64(reply, INVALID_PID);
WriteInt64(reply, INVALID_PID);
return EC_BADPTR;
}
APPSPAWN_LOGI("[appspawn] invoke.");
@ -149,7 +135,7 @@ static int Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, Ip
client.client.flags = 0;
if (GetMessageSt(&client.message, req) != EC_SUCCESS) {
APPSPAWN_LOGE("[appspawn] invoke, parse failed! reply %d.", INVALID_PID);
IpcIoPushInt64(reply, INVALID_PID);
WriteInt64(reply, INVALID_PID);
return EC_FAILURE;
}
@ -162,7 +148,7 @@ static int Invoke(IServerProxy *iProxy, int funcId, void *origin, IpcIo *req, Ip
newPid = -1;
}
FreeMessageSt(&client.message);
IpcIoPushInt64(reply, newPid);
WriteInt64(reply, newPid);
#ifdef OHOS_DEBUG
struct timespec tmEnd = {0};

View File

@ -23,7 +23,7 @@
"components": [
"hilog_lite",
"samgr_lite",
"ipc_lite",
"ipc_single",
"kv_store",
"aafwk_lite",
"ace_engine_lite",
@ -44,4 +44,4 @@
]
}
}
}
}