提交 cea6df10 编写于 作者: S Shengliang Guan

TD-2428

上级 69ce48ad
......@@ -949,9 +949,10 @@ static int32_t syncProcessPeerMsg(void *param, void *buffer) {
static void syncSendPeersStatusMsgToPeer(SSyncPeer *pPeer, char ack, int8_t type, uint16_t tranId) {
if (pPeer->peerFd < 0 || pPeer->ip == 0) return;
SSyncNode *pNode = pPeer->pSyncNode;
SPeersStatus msg = {0};
SSyncNode * pNode = pPeer->pSyncNode;
SPeersStatus msg;
memset(&msg, 0, sizeof(SPeersStatus));
syncBuildPeersStatus(&msg, pNode->vgId);
msg.role = nodeRole;
......
......@@ -88,7 +88,6 @@ void syncBuildSyncDataMsg(SSyncMsg *pMsg, int32_t vgId) { syncBuildMsg(pMsg, vgI
void syncBuildSyncSetupMsg(SSyncMsg *pMsg, int32_t vgId) { syncBuildMsg(pMsg, vgId, TAOS_SMSG_SETUP); }
void syncBuildPeersStatus(SPeersStatus *pMsg, int32_t vgId) {
memset(pMsg, 0, sizeof(SPeersStatus));
pMsg->head.type = TAOS_SMSG_STATUS;
pMsg->head.vgId = vgId;
pMsg->head.len = sizeof(SPeersStatus) - sizeof(SSyncHead);
......@@ -96,7 +95,6 @@ void syncBuildPeersStatus(SPeersStatus *pMsg, int32_t vgId) {
}
void syncBuildFileAck(SFileAck *pMsg, int32_t vgId) {
memset(pMsg, 0, sizeof(SFileAck));
pMsg->head.type = TAOS_SMSG_SYNC_FILE_RSP;
pMsg->head.vgId = vgId;
pMsg->head.len = sizeof(SFileAck) - sizeof(SSyncHead);
......@@ -104,7 +102,6 @@ void syncBuildFileAck(SFileAck *pMsg, int32_t vgId) {
}
void syncBuildFileInfo(SFileInfo *pMsg, int32_t vgId) {
memset(pMsg, 0, sizeof(SFileInfo));
pMsg->head.type = TAOS_SMSG_SYNC_FILE;
pMsg->head.vgId = vgId;
pMsg->head.len = sizeof(SFileInfo) - sizeof(SSyncHead);
......
......@@ -100,6 +100,7 @@ static int32_t syncRestoreFile(SSyncPeer *pPeer, uint64_t *fversion) {
&sinfo.fversion);
// if file not there or magic is not the same, file shall be synced
memset(&fileAck, 0, sizeof(SFileAck));
syncBuildFileAck(&fileAck, pNode->vgId);
fileAck.sync = (sinfo.magic != minfo.magic || sinfo.name[0] == 0) ? 1 : 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册