Merge branch 'pr_1028'

This commit is contained in:
wangfeng 2024-04-16 09:28:58 +08:00
commit 7d244bb244
3 changed files with 6 additions and 5 deletions

View File

@ -147,7 +147,7 @@ static int WriteMessage(int socketFd, const uint8_t *buf, ssize_t len)
const uint8_t *offset = buf;
for (ssize_t wLen = 0; remain > 0; offset += wLen, remain -= wLen, written += wLen) {
wLen = send(socketFd, offset, remain, MSG_NOSIGNAL);
APPSPAWN_LOGV("Write msg errno: %{public}d %{public}d", errno, wLen);
APPSPAWN_LOGV("Write msg errno: %{public}d %{public}zd", errno, wLen);
APPSPAWN_CHECK((wLen > 0) || (errno == EINTR), return -errno,
"Failed to write message to fd %{public}d, wLen %{public}zd errno: %{public}d", socketFd, wLen, errno);
}

View File

@ -167,7 +167,7 @@ static int CheckExtTlvInfo(const AppSpawnTlv *tlv, uint32_t remainLen)
APPSPAWN_LOGV("Recv type [%{public}s %{public}u] real len: %{public}u",
tlvExt->tlvName, tlvExt->tlvLen, tlvExt->dataLen);
if (tlvExt->dataLen > tlvExt->tlvLen - sizeof(AppSpawnTlvExt)) {
APPSPAWN_LOGE("Invalid tlv [%{public}s %{public}u] real len: %{public}u %{public}u",
APPSPAWN_LOGE("Invalid tlv [%{public}s %{public}u] real len: %{public}u %{public}zu",
tlvExt->tlvName, tlvExt->tlvLen, tlvExt->dataLen, sizeof(AppSpawnTlvExt));
return APPSPAWN_MSG_INVALID;
}
@ -219,10 +219,10 @@ int DecodeAppSpawnMsg(AppSpawnMsgNode *message)
while (currLen < bufferLen) {
AppSpawnTlv *tlv = (AppSpawnTlv *)(message->buffer + currLen);
APPSPAWN_CHECK(tlv->tlvLen <= (bufferLen - currLen), break,
"Invalid tlv [%{public}d %{public}d] curr: %{public}u",
"Invalid tlv [%{public}d %{public}d] curr: %{public}zu",
tlv->tlvType, tlv->tlvLen, currLen + sizeof(AppSpawnMsg));
APPSPAWN_LOGV("DecodeAppSpawnMsg tlv %{public}u %{public}u start: %{public}u ",
APPSPAWN_LOGV("DecodeAppSpawnMsg tlv %{public}u %{public}u start: %{public}zu ",
tlv->tlvType, tlv->tlvLen, currLen + sizeof(AppSpawnMsg)); // show in msg offset
ret = CheckMsgTlv(tlv, bufferLen - currLen);
APPSPAWN_CHECK_ONLY_EXPER(ret == 0, break);

View File

@ -25,6 +25,7 @@
#include <sys/eventfd.h>
#include <sys/wait.h>
#include <unistd.h>
#include <inttypes.h>
#include "appspawn.h"
#include "appspawn_client.h"
@ -212,7 +213,7 @@ void AppSpawnTestServer::ProcessIdle(const IdleHandle taskHandle, void *context)
clock_gettime(CLOCK_MONOTONIC, &end);
uint64_t diff = DiffTime(&server->startTime_, &end);
if (diff >= (server->protectTime_ * 1000)) { // 1000 ms -> us
APPSPAWN_LOGV("AppSpawnTestServer:: timeout %{public}u %{public}llu", server->protectTime_, diff);
APPSPAWN_LOGV("AppSpawnTestServer:: timeout %{public}u %{public}" PRIu64 "", server->protectTime_, diff);
server->StopSpawnService();
return;
}