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

@ -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;