未验证 提交 4a0468aa 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17945 from taosdata/enh/TD-20043

reafct: adjust sync propose
...@@ -111,10 +111,6 @@ typedef struct SElectTimer { ...@@ -111,10 +111,6 @@ typedef struct SElectTimer {
void* pData; void* pData;
} SElectTimer; } SElectTimer;
int32_t syncHbTimerInit(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer, SRaftId destId);
int32_t syncHbTimerStart(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer);
int32_t syncHbTimerStop(SSyncNode* pSyncNode, SSyncTimer* pSyncTimer);
typedef struct SPeerState { typedef struct SPeerState {
SyncIndex lastSendIndex; SyncIndex lastSendIndex;
int64_t lastSendTime; int64_t lastSendTime;
......
...@@ -182,9 +182,8 @@ typedef struct SyncClientRequest { ...@@ -182,9 +182,8 @@ typedef struct SyncClientRequest {
char data[]; // origin RpcMsg.pCont char data[]; // origin RpcMsg.pCont
} SyncClientRequest; } SyncClientRequest;
SyncClientRequest* syncClientRequestBuild(uint32_t dataLen); SyncClientRequest* syncClientRequestAlloc(uint32_t dataLen);
SyncClientRequest* syncClientRequestBuild2(const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, bool isWeak, SyncClientRequest* syncClientRequestBuild(const SRpcMsg* pMsg, uint64_t seqNum, bool isWeak, int32_t vgId); // step 1
int32_t vgId); // step 1
void syncClientRequestDestroy(SyncClientRequest* pMsg); void syncClientRequestDestroy(SyncClientRequest* pMsg);
void syncClientRequestSerialize(const SyncClientRequest* pMsg, char* buf, uint32_t bufLen); void syncClientRequestSerialize(const SyncClientRequest* pMsg, char* buf, uint32_t bufLen);
void syncClientRequestDeserialize(const char* buf, uint32_t len, SyncClientRequest* pMsg); void syncClientRequestDeserialize(const char* buf, uint32_t len, SyncClientRequest* pMsg);
......
此差异已折叠。
...@@ -831,21 +831,18 @@ void syncPingReplyLog2(char* s, const SyncPingReply* pMsg) { ...@@ -831,21 +831,18 @@ void syncPingReplyLog2(char* s, const SyncPingReply* pMsg) {
} }
// ---- message process SyncClientRequest---- // ---- message process SyncClientRequest----
SyncClientRequest* syncClientRequestBuild(uint32_t dataLen) { SyncClientRequest* syncClientRequestAlloc(uint32_t dataLen) {
uint32_t bytes = sizeof(SyncClientRequest) + dataLen; uint32_t bytes = sizeof(SyncClientRequest) + dataLen;
SyncClientRequest* pMsg = taosMemoryMalloc(bytes); SyncClientRequest* pMsg = taosMemoryCalloc(1, bytes);
memset(pMsg, 0, bytes);
pMsg->bytes = bytes; pMsg->bytes = bytes;
pMsg->msgType = TDMT_SYNC_CLIENT_REQUEST; pMsg->msgType = TDMT_SYNC_CLIENT_REQUEST;
pMsg->seqNum = 0;
pMsg->isWeak = false;
pMsg->dataLen = dataLen; pMsg->dataLen = dataLen;
return pMsg; return pMsg;
} }
// step 1. original SRpcMsg => SyncClientRequest, add seqNum, isWeak // step 1. original SRpcMsg => SyncClientRequest, add seqNum, isWeak
SyncClientRequest* syncClientRequestBuild2(const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, bool isWeak, int32_t vgId) { SyncClientRequest* syncClientRequestBuild(const SRpcMsg* pOriginalRpcMsg, uint64_t seqNum, bool isWeak, int32_t vgId) {
SyncClientRequest* pMsg = syncClientRequestBuild(pOriginalRpcMsg->contLen); SyncClientRequest* pMsg = syncClientRequestAlloc(pOriginalRpcMsg->contLen);
pMsg->vgId = vgId; pMsg->vgId = vgId;
pMsg->originalRpcType = pOriginalRpcMsg->msgType; pMsg->originalRpcType = pOriginalRpcMsg->msgType;
pMsg->seqNum = seqNum; pMsg->seqNum = seqNum;
...@@ -891,7 +888,6 @@ SyncClientRequest* syncClientRequestDeserialize2(const char* buf, uint32_t len) ...@@ -891,7 +888,6 @@ SyncClientRequest* syncClientRequestDeserialize2(const char* buf, uint32_t len)
// step 2. SyncClientRequest => RpcMsg, to queue // step 2. SyncClientRequest => RpcMsg, to queue
void syncClientRequest2RpcMsg(const SyncClientRequest* pMsg, SRpcMsg* pRpcMsg) { void syncClientRequest2RpcMsg(const SyncClientRequest* pMsg, SRpcMsg* pRpcMsg) {
memset(pRpcMsg, 0, sizeof(*pRpcMsg));
pRpcMsg->msgType = pMsg->msgType; pRpcMsg->msgType = pMsg->msgType;
pRpcMsg->contLen = pMsg->bytes; pRpcMsg->contLen = pMsg->bytes;
pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen); pRpcMsg->pCont = rpcMallocCont(pRpcMsg->contLen);
......
...@@ -142,7 +142,7 @@ char* syncUtilPrintBin(char* ptr, uint32_t len) { ...@@ -142,7 +142,7 @@ char* syncUtilPrintBin(char* ptr, uint32_t len) {
memset(s, 0, len + 1); memset(s, 0, len + 1);
memcpy(s, ptr, len); memcpy(s, ptr, len);
for (int i = 0; i < len; ++i) { for (int32_t i = 0; i < len; ++i) {
if (!syncUtilCanPrint(s[i])) { if (!syncUtilCanPrint(s[i])) {
s[i] = '.'; s[i] = '.';
} }
...@@ -157,8 +157,8 @@ char* syncUtilPrintBin2(char* ptr, uint32_t len) { ...@@ -157,8 +157,8 @@ char* syncUtilPrintBin2(char* ptr, uint32_t len) {
memset(s, 0, len2); memset(s, 0, len2);
char* p = s; char* p = s;
for (int i = 0; i < len; ++i) { for (int32_t i = 0; i < len; ++i) {
int n = sprintf(p, "%d,", ptr[i]); int32_t n = sprintf(p, "%d,", ptr[i]);
p += n; p += n;
} }
return s; return s;
...@@ -178,29 +178,11 @@ void syncUtilMsgNtoH(void* msg) { ...@@ -178,29 +178,11 @@ void syncUtilMsgNtoH(void* msg) {
pHead->vgId = ntohl(pHead->vgId); pHead->vgId = ntohl(pHead->vgId);
} }
bool syncUtilUserPreCommit(tmsg_t msgType) { bool syncUtilUserPreCommit(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; }
if (msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER) {
return true;
}
return false;
}
bool syncUtilUserCommit(tmsg_t msgType) { bool syncUtilUserCommit(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; }
if (msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER) {
return true;
}
return false; bool syncUtilUserRollback(tmsg_t msgType) { return msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER; }
}
bool syncUtilUserRollback(tmsg_t msgType) {
if (msgType != TDMT_SYNC_NOOP && msgType != TDMT_SYNC_LEADER_TRANSFER) {
return true;
}
return false;
}
void syncCfg2SimpleStr(const SSyncCfg* pCfg, char* buf, int32_t bufLen) { void syncCfg2SimpleStr(const SSyncCfg* pCfg, char* buf, int32_t bufLen) {
int32_t len = snprintf(buf, bufLen, "{r-num:%d, my:%d, ", pCfg->replicaNum, pCfg->myIndex); int32_t len = snprintf(buf, bufLen, "{r-num:%d, my:%d, ", pCfg->replicaNum, pCfg->myIndex);
......
...@@ -74,8 +74,8 @@ void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg) { ...@@ -74,8 +74,8 @@ void voteGrantedVote(SVotesGranted *pVotesGranted, SyncRequestVoteReply *pMsg) {
ASSERT(syncUtilSameId(&pVotesGranted->pSyncNode->myRaftId, &pMsg->destId)); ASSERT(syncUtilSameId(&pVotesGranted->pSyncNode->myRaftId, &pMsg->destId));
int j = -1; int32_t j = -1;
for (int i = 0; i < pVotesGranted->replicaNum; ++i) { for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) {
if (syncUtilSameId(&((*(pVotesGranted->replicas))[i]), &(pMsg->srcId))) { if (syncUtilSameId(&((*(pVotesGranted->replicas))[i]), &(pMsg->srcId))) {
j = i; j = i;
break; break;
...@@ -105,11 +105,11 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) { ...@@ -105,11 +105,11 @@ cJSON *voteGranted2Json(SVotesGranted *pVotesGranted) {
cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesGranted->replicaNum); cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesGranted->replicaNum);
cJSON *pReplicas = cJSON_CreateArray(); cJSON *pReplicas = cJSON_CreateArray();
cJSON_AddItemToObject(pRoot, "replicas", pReplicas); cJSON_AddItemToObject(pRoot, "replicas", pReplicas);
for (int i = 0; i < pVotesGranted->replicaNum; ++i) { for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) {
cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesGranted->replicas))[i])); cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesGranted->replicas))[i]));
} }
int *arr = (int *)taosMemoryMalloc(sizeof(int) * pVotesGranted->replicaNum); int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesGranted->replicaNum);
for (int i = 0; i < pVotesGranted->replicaNum; ++i) { for (int32_t i = 0; i < pVotesGranted->replicaNum; ++i) {
arr[i] = pVotesGranted->isGranted[i]; arr[i] = pVotesGranted->isGranted[i];
} }
cJSON *pIsGranted = cJSON_CreateIntArray(arr, pVotesGranted->replicaNum); cJSON *pIsGranted = cJSON_CreateIntArray(arr, pVotesGranted->replicaNum);
...@@ -168,7 +168,7 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSyncNode) { ...@@ -168,7 +168,7 @@ void votesRespondUpdate(SVotesRespond *pVotesRespond, SSyncNode *pSyncNode) {
bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId) { bool votesResponded(SVotesRespond *pVotesRespond, const SRaftId *pRaftId) {
bool ret = false; bool ret = false;
for (int i = 0; i < pVotesRespond->replicaNum; ++i) { for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) {
if (syncUtilSameId(&(*pVotesRespond->replicas)[i], pRaftId) && pVotesRespond->isRespond[i]) { if (syncUtilSameId(&(*pVotesRespond->replicas)[i], pRaftId) && pVotesRespond->isRespond[i]) {
ret = true; ret = true;
break; break;
...@@ -183,7 +183,7 @@ void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *p ...@@ -183,7 +183,7 @@ void votesRespondAdd(SVotesRespond *pVotesRespond, const SyncRequestVoteReply *p
return; return;
} }
for (int i = 0; i < pVotesRespond->replicaNum; ++i) { for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) {
if (syncUtilSameId(&((*(pVotesRespond->replicas))[i]), &pMsg->srcId)) { if (syncUtilSameId(&((*(pVotesRespond->replicas))[i]), &pMsg->srcId)) {
// ASSERT(pVotesRespond->isRespond[i] == false); // ASSERT(pVotesRespond->isRespond[i] == false);
pVotesRespond->isRespond[i] = true; pVotesRespond->isRespond[i] = true;
...@@ -197,7 +197,7 @@ void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term) { ...@@ -197,7 +197,7 @@ void votesRespondReset(SVotesRespond *pVotesRespond, SyncTerm term) {
pVotesRespond->term = term; pVotesRespond->term = term;
memset(pVotesRespond->isRespond, 0, sizeof(pVotesRespond->isRespond)); memset(pVotesRespond->isRespond, 0, sizeof(pVotesRespond->isRespond));
/* /*
for (int i = 0; i < pVotesRespond->replicaNum; ++i) { for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) {
pVotesRespond->isRespond[i] = false; pVotesRespond->isRespond[i] = false;
} }
*/ */
...@@ -211,12 +211,12 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) { ...@@ -211,12 +211,12 @@ cJSON *votesRespond2Json(SVotesRespond *pVotesRespond) {
cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesRespond->replicaNum); cJSON_AddNumberToObject(pRoot, "replicaNum", pVotesRespond->replicaNum);
cJSON *pReplicas = cJSON_CreateArray(); cJSON *pReplicas = cJSON_CreateArray();
cJSON_AddItemToObject(pRoot, "replicas", pReplicas); cJSON_AddItemToObject(pRoot, "replicas", pReplicas);
for (int i = 0; i < pVotesRespond->replicaNum; ++i) { for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) {
cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesRespond->replicas))[i])); cJSON_AddItemToArray(pReplicas, syncUtilRaftId2Json(&(*(pVotesRespond->replicas))[i]));
} }
int respondNum = 0; int32_t respondNum = 0;
int *arr = (int *)taosMemoryMalloc(sizeof(int) * pVotesRespond->replicaNum); int32_t *arr = (int32_t *)taosMemoryMalloc(sizeof(int32_t) * pVotesRespond->replicaNum);
for (int i = 0; i < pVotesRespond->replicaNum; ++i) { for (int32_t i = 0; i < pVotesRespond->replicaNum; ++i) {
arr[i] = pVotesRespond->isRespond[i]; arr[i] = pVotesRespond->isRespond[i];
if (pVotesRespond->isRespond[i]) { if (pVotesRespond->isRespond[i]) {
respondNum++; respondNum++;
......
...@@ -81,7 +81,7 @@ void test4() { ...@@ -81,7 +81,7 @@ void test4() {
void test5() { void test5() {
SyncApplyMsg *pMsg = createMsg(); SyncApplyMsg *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncApplyMsg2RpcMsg(pMsg, &rpcMsg); syncApplyMsg2RpcMsg(pMsg, &rpcMsg);
SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg); SyncApplyMsg *pMsg2 = syncApplyMsgFromRpcMsg2(&rpcMsg);
syncApplyMsgLog2((char *)"test5: syncClientRequest2RpcMsg -> syncApplyMsgFromRpcMsg2 ", pMsg2); syncApplyMsgLog2((char *)"test5: syncClientRequest2RpcMsg -> syncApplyMsgFromRpcMsg2 ", pMsg2);
......
...@@ -59,7 +59,7 @@ void test2() { ...@@ -59,7 +59,7 @@ void test2() {
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char * serialized = (char *)taosMemoryMalloc(len); char * serialized = (char *)taosMemoryMalloc(len);
syncClientRequestSerialize(pMsg, serialized, len); syncClientRequestSerialize(pMsg, serialized, len);
SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen); SyncClientRequest *pMsg2 = syncClientRequestAlloc(pMsg->dataLen);
syncClientRequestDeserialize(serialized, len, pMsg2); syncClientRequestDeserialize(serialized, len, pMsg2);
syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2); syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2);
......
...@@ -21,7 +21,7 @@ SyncClientRequest *createMsg() { ...@@ -21,7 +21,7 @@ SyncClientRequest *createMsg() {
rpcMsg.contLen = 20; rpcMsg.contLen = 20;
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
strcpy((char *)rpcMsg.pCont, "hello rpc"); strcpy((char *)rpcMsg.pCont, "hello rpc");
SyncClientRequest *pMsg = syncClientRequestBuild2(&rpcMsg, 123, true, 1000); SyncClientRequest *pMsg = syncClientRequestBuild(&rpcMsg, 123, true, 1000);
rpcFreeCont(rpcMsg.pCont); rpcFreeCont(rpcMsg.pCont);
return pMsg; return pMsg;
} }
...@@ -37,7 +37,7 @@ void test2() { ...@@ -37,7 +37,7 @@ void test2() {
uint32_t len = pMsg->bytes; uint32_t len = pMsg->bytes;
char *serialized = (char *)taosMemoryMalloc(len); char *serialized = (char *)taosMemoryMalloc(len);
syncClientRequestSerialize(pMsg, serialized, len); syncClientRequestSerialize(pMsg, serialized, len);
SyncClientRequest *pMsg2 = syncClientRequestBuild(pMsg->dataLen); SyncClientRequest *pMsg2 = syncClientRequestAlloc(pMsg->dataLen);
syncClientRequestDeserialize(serialized, len, pMsg2); syncClientRequestDeserialize(serialized, len, pMsg2);
syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2); syncClientRequestLog2((char *)"test2: syncClientRequestSerialize -> syncClientRequestDeserialize ", pMsg2);
...@@ -60,7 +60,7 @@ void test3() { ...@@ -60,7 +60,7 @@ void test3() {
void test4() { void test4() {
SyncClientRequest *pMsg = createMsg(); SyncClientRequest *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pMsg, &rpcMsg); syncClientRequest2RpcMsg(pMsg, &rpcMsg);
SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(rpcMsg.contLen); SyncClientRequest *pMsg2 = (SyncClientRequest *)taosMemoryMalloc(rpcMsg.contLen);
syncClientRequestFromRpcMsg(&rpcMsg, pMsg2); syncClientRequestFromRpcMsg(&rpcMsg, pMsg2);
...@@ -73,7 +73,7 @@ void test4() { ...@@ -73,7 +73,7 @@ void test4() {
void test5() { void test5() {
SyncClientRequest *pMsg = createMsg(); SyncClientRequest *pMsg = createMsg();
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pMsg, &rpcMsg); syncClientRequest2RpcMsg(pMsg, &rpcMsg);
SyncClientRequest *pMsg2 = syncClientRequestFromRpcMsg2(&rpcMsg); SyncClientRequest *pMsg2 = syncClientRequestFromRpcMsg2(&rpcMsg);
syncClientRequestLog2((char *)"test5: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg2 ", pMsg2); syncClientRequestLog2((char *)"test5: syncClientRequest2RpcMsg -> syncClientRequestFromRpcMsg2 ", pMsg2);
......
...@@ -102,12 +102,12 @@ SRpcMsg *step0() { ...@@ -102,12 +102,12 @@ SRpcMsg *step0() {
} }
SyncClientRequest *step1(const SRpcMsg *pMsg) { SyncClientRequest *step1(const SRpcMsg *pMsg) {
SyncClientRequest *pRetMsg = syncClientRequestBuild2(pMsg, 123, true, 1000); SyncClientRequest *pRetMsg = syncClientRequestBuild(pMsg, 123, true, 1000);
return pRetMsg; return pRetMsg;
} }
SRpcMsg *step2(const SyncClientRequest *pMsg) { SRpcMsg *step2(const SyncClientRequest *pMsg) {
SRpcMsg *pRetMsg = (SRpcMsg *)taosMemoryMalloc(sizeof(SRpcMsg)); SRpcMsg *pRetMsg = (SRpcMsg *)taosMemoryCalloc(sizeof(SRpcMsg), 1);
syncClientRequest2RpcMsg(pMsg, pRetMsg); syncClientRequest2RpcMsg(pMsg, pRetMsg);
return pRetMsg; return pRetMsg;
} }
......
...@@ -32,7 +32,7 @@ void test1() { ...@@ -32,7 +32,7 @@ void test1() {
} }
void test2() { void test2() {
SyncClientRequest* pSyncMsg = syncClientRequestBuild(10); SyncClientRequest* pSyncMsg = syncClientRequestAlloc(10);
pSyncMsg->originalRpcType = 33; pSyncMsg->originalRpcType = 33;
pSyncMsg->seqNum = 11; pSyncMsg->seqNum = 11;
pSyncMsg->isWeak = 1; pSyncMsg->isWeak = 1;
...@@ -46,7 +46,7 @@ void test2() { ...@@ -46,7 +46,7 @@ void test2() {
} }
void test3() { void test3() {
SyncClientRequest* pSyncMsg = syncClientRequestBuild(10); SyncClientRequest* pSyncMsg = syncClientRequestAlloc(10);
pSyncMsg->originalRpcType = 33; pSyncMsg->originalRpcType = 33;
pSyncMsg->seqNum = 11; pSyncMsg->seqNum = 11;
pSyncMsg->isWeak = 1; pSyncMsg->isWeak = 1;
......
...@@ -47,7 +47,7 @@ SyncClientRequest *createSyncClientRequest() { ...@@ -47,7 +47,7 @@ SyncClientRequest *createSyncClientRequest() {
rpcMsg.contLen = 20; rpcMsg.contLen = 20;
rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen); rpcMsg.pCont = rpcMallocCont(rpcMsg.contLen);
strcpy((char *)rpcMsg.pCont, "hello rpc"); strcpy((char *)rpcMsg.pCont, "hello rpc");
SyncClientRequest *pMsg = syncClientRequestBuild2(&rpcMsg, 123, true, 1000); SyncClientRequest *pMsg = syncClientRequestBuild(&rpcMsg, 123, true, 1000);
return pMsg; return pMsg;
} }
...@@ -156,7 +156,7 @@ void test7() { ...@@ -156,7 +156,7 @@ void test7() {
void test8() { void test8() {
SyncClientRequest *pMsg = createSyncClientRequest(); SyncClientRequest *pMsg = createSyncClientRequest();
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pMsg, &rpcMsg); syncClientRequest2RpcMsg(pMsg, &rpcMsg);
syncRpcMsgLog2((char *)"test8", &rpcMsg); syncRpcMsgLog2((char *)"test8", &rpcMsg);
syncClientRequestDestroy(pMsg); syncClientRequestDestroy(pMsg);
......
...@@ -162,7 +162,7 @@ SRpcMsg *step0() { ...@@ -162,7 +162,7 @@ SRpcMsg *step0() {
} }
SyncClientRequest *step1(const SRpcMsg *pMsg) { SyncClientRequest *step1(const SRpcMsg *pMsg) {
SyncClientRequest *pRetMsg = syncClientRequestBuild2(pMsg, 123, true, 1000); SyncClientRequest *pRetMsg = syncClientRequestBuild(pMsg, 123, true, 1000);
return pRetMsg; return pRetMsg;
} }
...@@ -206,7 +206,7 @@ int main(int argc, char **argv) { ...@@ -206,7 +206,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
SyncClientRequest *pSyncClientRequest = pMsg1; SyncClientRequest *pSyncClientRequest = pMsg1;
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg);
gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg);
......
...@@ -140,7 +140,7 @@ SRpcMsg *step0() { ...@@ -140,7 +140,7 @@ SRpcMsg *step0() {
} }
SyncClientRequest *step1(const SRpcMsg *pMsg) { SyncClientRequest *step1(const SRpcMsg *pMsg) {
SyncClientRequest *pRetMsg = syncClientRequestBuild2(pMsg, 123, true, 1000); SyncClientRequest *pRetMsg = syncClientRequestBuild(pMsg, 123, true, 1000);
return pRetMsg; return pRetMsg;
} }
...@@ -181,7 +181,7 @@ int main(int argc, char **argv) { ...@@ -181,7 +181,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
SyncClientRequest *pSyncClientRequest = pMsg1; SyncClientRequest *pSyncClientRequest = pMsg1;
SRpcMsg rpcMsg; SRpcMsg rpcMsg = {0};
syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg); syncClientRequest2RpcMsg(pSyncClientRequest, &rpcMsg);
gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg); gSyncNode->syncEqMsg(gSyncNode->msgcb, &rpcMsg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册