fix bug: coldstart

Signed-off-by: chennuo <chennuo12@huawei.com>
This commit is contained in:
chennuo 2024-08-27 20:57:09 +08:00
parent 0041ead4ff
commit 239b9c4213
2 changed files with 9 additions and 14 deletions

View File

@ -304,19 +304,6 @@ void DeleteAppSpawningCtx(AppSpawningCtx *property)
APPSPAWN_CHECK_ONLY_EXPER(property != NULL, return);
APPSPAWN_LOGV("DeleteAppSpawningCtx");
int isNweb = IsNWebSpawnMode((AppSpawnMgr *)GetAppSpawnContent());
if (property->forkCtx.childMsg != NULL) {
munmap((char *)property->forkCtx.childMsg, property->forkCtx.msgSize);
property->forkCtx.childMsg = NULL;
if (property->message != NULL) {
char path[PATH_MAX] = {};
int len = sprintf_s(path, sizeof(path), APPSPAWN_MSG_DIR "%s/%s_%d",
isNweb ? "nwebspawn" : "appspawn", property->message->msgHeader.processName, property->client.id);
if (len > 0) {
unlink(path);
}
}
}
DeleteAppSpawnMsg(property->message);
OH_ListRemove(&property->node);

View File

@ -1039,10 +1039,11 @@ static AppSpawningCtx *GetAppSpawningCtxFromArg(AppSpawnMgr *content, int argc,
property->client.flags = atoi(argv[FLAGS_VALUE_INDEX]);
property->client.flags &= ~APP_COLD_START;
int isNweb = IsNWebSpawnMode(content);
uint32_t size = atoi(argv[SHM_SIZE_INDEX]);
property->client.id = atoi(argv[CLIENT_ID_INDEX]);
uint8_t *buffer = (uint8_t *)GetMapMem(property->client.id,
argv[PARAM_VALUE_INDEX], size, true, IsNWebSpawnMode(content));
argv[PARAM_VALUE_INDEX], size, true, isNweb);
if (buffer == NULL) {
APPSPAWN_LOGE("Failed to map errno %{public}d %{public}s", property->client.id, argv[PARAM_VALUE_INDEX]);
NotifyResToParent(&content->content, &property->client, APPSPAWN_SYSTEM_ERROR);
@ -1056,6 +1057,13 @@ static AppSpawningCtx *GetAppSpawningCtxFromArg(AppSpawnMgr *content, int argc,
int ret = GetAppSpawnMsgFromBuffer(buffer, ((AppSpawnMsg *)buffer)->msgLen, &message, &msgRecvLen, &remainLen);
// release map
munmap((char *)buffer, size);
//unlink
char path[PATH_MAX] = {0};
int len = sprintf_s(path, sizeof(path), APPSPAWN_MSG_DIR "%s/%s_%d",
isNweb ? "nwebspawn" : "appspawn", argv[PARAM_VALUE_INDEX], property->client.id);
if (len > 0) {
unlink(path);
}
if (ret == 0 && DecodeAppSpawnMsg(message) == 0 && CheckAppSpawnMsg(message) == 0) {
property->message = message;