change msg define

This commit is contained in:
yihaoDeng 2024-07-19 21:41:40 +08:00
parent 01a8412805
commit 5172d3cd8a
1 changed files with 15 additions and 12 deletions

View File

@ -45,7 +45,7 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
SRetrieveIpWhiteReq req = {.ipWhiteVer = oldVer}; SRetrieveIpWhiteReq req = {.ipWhiteVer = oldVer};
int32_t contLen = tSerializeRetrieveIpWhite(NULL, 0, &req); int32_t contLen = tSerializeRetrieveIpWhite(NULL, 0, &req);
void *pHead = rpcMallocCont(contLen); void * pHead = rpcMallocCont(contLen);
tSerializeRetrieveIpWhite(pHead, contLen, &req); tSerializeRetrieveIpWhite(pHead, contLen, &req);
SRpcMsg rpcMsg = {.pCont = pHead, SRpcMsg rpcMsg = {.pCont = pHead,
@ -146,7 +146,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req.ipWhiteVer = pMgmt->pData->ipWhiteVer; req.ipWhiteVer = pMgmt->pData->ipWhiteVer;
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req); int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
void *pHead = rpcMallocCont(contLen); void * pHead = rpcMallocCont(contLen);
tSerializeSStatusReq(pHead, contLen, &req); tSerializeSStatusReq(pHead, contLen, &req);
tFreeSStatusReq(&req); tFreeSStatusReq(&req);
@ -180,7 +180,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) { void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
int32_t contLen = tSerializeSNotifyReq(NULL, 0, pReq); int32_t contLen = tSerializeSNotifyReq(NULL, 0, pReq);
void *pHead = rpcMallocCont(contLen); void * pHead = rpcMallocCont(contLen);
tSerializeSNotifyReq(pHead, contLen, pReq); tSerializeSNotifyReq(pHead, contLen, pReq);
SRpcMsg rpcMsg = {.pCont = pHead, SRpcMsg rpcMsg = {.pCont = pHead,
@ -285,24 +285,27 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SServerStatusRsp statusRsp = {0}; SServerStatusRsp statusRsp = {0};
dmGetServerRunStatus(pMgmt, &statusRsp); dmGetServerRunStatus(pMgmt, &statusRsp);
pMsg->info.rsp = NULL;
pMsg->info.rspLen = 0;
SRpcMsg rspMsg = {.info = pMsg->info}; SRpcMsg rspMsg = {.info = pMsg->info};
int32_t rspLen = tSerializeSServerStatusRsp(NULL, 0, &statusRsp); int32_t rspLen = tSerializeSServerStatusRsp(NULL, 0, &statusRsp);
if (rspLen < 0) { if (rspLen < 0) {
rspMsg.code = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
return rspMsg.code; // rspMsg.code = TSDB_CODE_OUT_OF_MEMORY;
// return rspMsg.code;
} }
void *pRsp = rpcMallocCont(rspLen); void *pRsp = rpcMallocCont(rspLen);
if (pRsp == NULL) { if (pRsp == NULL) {
rspMsg.code = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY;
return rspMsg.code; // rspMsg.code = TSDB_CODE_OUT_OF_MEMORY;
// return rspMsg.code;
} }
code = tSerializeSServerStatusRsp(pRsp, rspLen, &statusRsp); rspLen = tSerializeSServerStatusRsp(pRsp, rspLen, &statusRsp);
if (code != 0) { if (rspLen < 0) {
rpcFreeCont(pRsp); return TSDB_CODE_INVALID_MSG;
rspMsg.code = code;
return code;
} }
pMsg->info.rsp = pRsp; pMsg->info.rsp = pRsp;