diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 58a7f8f448..7973aa1b46 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -566,30 +566,34 @@ int32_t tSerializeSClientHbBatchRsp(void *buf, int32_t bufLen, const SClientHbBa int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchRsp *pBatchRsp) { SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); + int32_t ret = -1; - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) return -1; - if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) return -1; - if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) return -1; + if (tStartDecode(&decoder) < 0) goto _END; + if (tDecodeI64(&decoder, &pBatchRsp->reqId) < 0) goto _END; + if (tDecodeI64(&decoder, &pBatchRsp->rspId) < 0) goto _END; + if (tDecodeI32(&decoder, &pBatchRsp->svrTimestamp) < 0) goto _END; int32_t rspNum = 0; - if (tDecodeI32(&decoder, &rspNum) < 0) return -1; + if (tDecodeI32(&decoder, &rspNum) < 0) goto _END; if (pBatchRsp->rsps == NULL) { - if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) return -1; + if ((pBatchRsp->rsps = taosArrayInit(rspNum, sizeof(SClientHbRsp))) == NULL) goto _END; } for (int32_t i = 0; i < rspNum; i++) { SClientHbRsp rsp = {0}; - if (tDeserializeSClientHbRsp(&decoder, &rsp) < 0) return -1; - if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) return -1; + if (tDeserializeSClientHbRsp(&decoder, &rsp) < 0) goto _END; + if (taosArrayPush(pBatchRsp->rsps, &rsp) == NULL) goto _END; } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) return -1; + if (tDeserializeSMonitorParas(&decoder, &pBatchRsp->monitorParas) < 0) goto _END; } tEndDecode(&decoder); + ret = 0; + +_END: tDecoderClear(&decoder); - return 0; + return ret; } int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq) { @@ -5258,44 +5262,47 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); + int32_t ret = -1; - if (tStartDecode(&decoder) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->acctId) < 0) return -1; - if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) return -1; - if (tDecodeU32(&decoder, &pRsp->connId) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->superUser) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) return -1; - if (tDecodeI8(&decoder, &pRsp->connType) < 0) return -1; - if (tDecodeSEpSet(&decoder, &pRsp->epSet) < 0) return -1; - if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) return -1; - if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) return -1; + if (tStartDecode(&decoder) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->acctId) < 0) goto _END; + if (tDecodeI64(&decoder, &pRsp->clusterId) < 0) goto _END; + if (tDecodeU32(&decoder, &pRsp->connId) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->dnodeNum) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->superUser) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->sysInfo) < 0) goto _END; + if (tDecodeI8(&decoder, &pRsp->connType) < 0) goto _END; + if (tDecodeSEpSet(&decoder,&pRsp->epSet) < 0) goto _END; + if (tDecodeI32(&decoder, &pRsp->svrTimestamp) < 0) goto _END; + if (tDecodeCStrTo(&decoder, pRsp->sVer) < 0) goto _END; + if (tDecodeCStrTo(&decoder, pRsp->sDetailVer) < 0) goto _END; if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->passVer) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->passVer) < 0) goto _END; } else { pRsp->passVer = 0; } // since 3.0.7.0 if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI32(&decoder, &pRsp->authVer) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->authVer) < 0) goto _END; } else { pRsp->authVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) return -1; + if (tDecodeI64(&decoder, &pRsp->whiteListVer) < 0) goto _END; } else { pRsp->whiteListVer = 0; } if (!tDecodeIsEnd(&decoder)) { - if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) return -1; + if (tDeserializeSMonitorParas(&decoder, &pRsp->monitorParas) < 0) goto _END; } tEndDecode(&decoder); + ret = 0; +_END: tDecoderClear(&decoder); - return 0; + return ret; } int32_t tSerializeSMTimerMsg(void *buf, int32_t bufLen, SMTimerReq *pReq) { diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 7a20898911..8dfb6f6a00 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -313,7 +313,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShell.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellError.py -,,n,system-test,python3 ./test.py -f 0-others/taosShellNetChk.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShellNetChk.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/telemetry.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/backquote_check.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosdMonitor.py