diff --git a/source/libs/sync/inc/syncMessage.h b/source/libs/sync/inc/syncMessage.h index a4ae91060891bd3ea9a383ea4f610cfe099ad07a..bb9ec65d3b3c169aac44e027da7826fc27e1dc91 100644 --- a/source/libs/sync/inc/syncMessage.h +++ b/source/libs/sync/inc/syncMessage.h @@ -30,8 +30,8 @@ extern "C" { // encode as uint64 typedef enum ESyncMessageType { - SYNC_PING = 100, - SYNC_PING_REPLY, + SYNC_PING = 101, + SYNC_PING_REPLY = 103, SYNC_CLIENT_REQUEST, SYNC_CLIENT_REQUEST_REPLY, SYNC_REQUEST_VOTE, diff --git a/source/libs/sync/src/syncIO.c b/source/libs/sync/src/syncIO.c index 85a9459483e699181428ac9dae4327743e9fa2fd..590466d1ccb6e7b6d7c4ce8dfc5f192daa59e482 100644 --- a/source/libs/sync/src/syncIO.c +++ b/source/libs/sync/src/syncIO.c @@ -216,19 +216,10 @@ static void *syncIOConsumerFunc(void *param) { 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 + syncPingFromRpcMsg(pRpcMsg, pSyncMsg); + + // memcpy(pSyncMsg, tmpRpcMsg.pCont, tmpRpcMsg.contLen); + io->FpOnSyncPing(io->pSyncNode, pSyncMsg); } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 180a2b13a1cd18b788c80263332a3ae13b731038..ce3dba4c0eac858d88f8eef068e299f38744b777 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -230,7 +230,16 @@ static int32_t syncNodeSendMsgByInfo(const SNodeInfo* nodeInfo, SSyncNode* pSync static int32_t syncNodeOnPingCb(SSyncNode* ths, SyncPing* pMsg) { int32_t ret = 0; - sTrace("syncNodeOnPingCb ---- ========="); + sTrace("<-- syncNodeOnPingCb -->"); + + { + cJSON* pJson = syncPing2Json(pMsg); + char* serialized = cJSON_Print(pJson); + sTrace("syncNodeOnPingCb syncNodePing pMsg:%s ", serialized); + free(serialized); + cJSON_Delete(pJson); + } + return ret; }