From cd494803eeb2460d4db2588bbf34f05d6e524512 Mon Sep 17 00:00:00 2001 From: kailixu Date: Mon, 3 Jul 2023 20:39:50 +0800 Subject: [PATCH] chore: code optimization --- source/client/src/clientHb.c | 41 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 34105be00f..04cb1821b0 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -90,33 +90,32 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat break; } } + if (!pRsp) { + releaseTscObj(pReq->connKey.tscRid); + break; + } } - if (pRsp) { - pTscObj->authVer = pRsp->version; - if (pTscObj->sysInfo != pRsp->sysInfo) { - tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, pRsp->user, - pTscObj->sysInfo, pRsp->sysInfo, pTscObj->id); - pTscObj->sysInfo = pRsp->sysInfo; - } + pTscObj->authVer = pRsp->version; + + if (pTscObj->sysInfo != pRsp->sysInfo) { + tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, pRsp->user, + pTscObj->sysInfo, pRsp->sysInfo, pTscObj->id); + pTscObj->sysInfo = pRsp->sysInfo; + } - if (pTscObj->passInfo.fp) { - SPassInfo *passInfo = &pTscObj->passInfo; - int32_t oldVer = atomic_load_32(&passInfo->ver); - if (oldVer < pRsp->passVer) { - atomic_store_32(&passInfo->ver, pRsp->passVer); - if (passInfo->fp) { - (*passInfo->fp)(passInfo->param, &pRsp->passVer, TAOS_NOTIFY_PASSVER); - } - tscDebug("update passVer of user %s from %d to %d, tscRid:%" PRIi64, pRsp->user, oldVer, - atomic_load_32(&passInfo->ver), pTscObj->id); + if (pTscObj->passInfo.fp) { + SPassInfo *passInfo = &pTscObj->passInfo; + int32_t oldVer = atomic_load_32(&passInfo->ver); + if (oldVer < pRsp->passVer) { + atomic_store_32(&passInfo->ver, pRsp->passVer); + if (passInfo->fp) { + (*passInfo->fp)(passInfo->param, &pRsp->passVer, TAOS_NOTIFY_PASSVER); } + tscDebug("update passVer of user %s from %d to %d, tscRid:%" PRIi64, pRsp->user, oldVer, + atomic_load_32(&passInfo->ver), pTscObj->id); } - } else { - releaseTscObj(pReq->connKey.tscRid); - break; } - releaseTscObj(pReq->connKey.tscRid); } } -- GitLab