From 99bc46e7de6bbcd938c5d413c033d0e560b03b74 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 2 Mar 2022 19:56:15 +0800 Subject: [PATCH] sync modify timer --- source/libs/sync/src/syncIO.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/source/libs/sync/src/syncIO.c b/source/libs/sync/src/syncIO.c index bd49b04375..85a9459483 100644 --- a/source/libs/sync/src/syncIO.c +++ b/source/libs/sync/src/syncIO.c @@ -210,10 +210,28 @@ static void *syncIOConsumerFunc(void *param) { if (pRpcMsg->msgType == SYNC_PING) { if (io->FpOnSyncPing != NULL) { - SyncPing *pSyncMsg = syncPingBuild(pRpcMsg->contLen); - syncPingFromRpcMsg(pRpcMsg, pSyncMsg); + SyncPing *pSyncMsg; + + SRpcMsg tmpRpcMsg; + memcpy(&tmpRpcMsg, pRpcMsg, sizeof(SRpcMsg)); + pSyncMsg = syncPingBuild(tmpRpcMsg.contLen); + + // syncPingFromRpcMsg(pRpcMsg, pSyncMsg); + + memcpy(pSyncMsg, tmpRpcMsg.pCont, tmpRpcMsg.contLen); + +#if 0 + { + cJSON *pJson = syncPing2Json(pSyncMsg); + char *serialized = cJSON_Print(pJson); + sTrace("syncIOConsumerFunc syncNodePing pMsg:%s ", serialized); + free(serialized); + cJSON_Delete(pJson); + } +#endif io->FpOnSyncPing(io->pSyncNode, pSyncMsg); } + } else if (pRpcMsg->msgType == SYNC_PING_REPLY) { SyncPingReply *pSyncMsg = syncPingReplyBuild(pRpcMsg->contLen); syncPingReplyFromRpcMsg(pRpcMsg, pSyncMsg); @@ -257,7 +275,8 @@ static int syncIOAuth(void *parent, char *meterId, char *spi, char *encrypt, cha } static void syncIOProcessRequest(void *pParent, SRpcMsg *pMsg, SEpSet *pEpSet) { - sTrace("syncIOProcessRequest: type:%d, contLen:%d, cont:%s", pMsg->msgType, pMsg->contLen, (char *)pMsg->pCont); + sTrace("<-- syncIOProcessRequest --> type:%d, contLen:%d, cont:%s", pMsg->msgType, pMsg->contLen, + (char *)pMsg->pCont); SSyncIO *io = pParent; SRpcMsg *pTemp; -- GitLab