提交 64281ece 编写于 作者: K kailixu

chore: code optimization

上级 a709f7c0
...@@ -75,39 +75,48 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat ...@@ -75,39 +75,48 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat
} }
SClientHbReq *pReq = NULL; SClientHbReq *pReq = NULL;
SGetUserAuthRsp *pRsp = NULL;
while ((pReq = taosHashIterate(hbMgr->activeInfo, pReq))) { while ((pReq = taosHashIterate(hbMgr->activeInfo, pReq))) {
STscObj *pTscObj = (STscObj *)acquireTscObj(pReq->connKey.tscRid); STscObj *pTscObj = (STscObj *)acquireTscObj(pReq->connKey.tscRid);
if (!pTscObj) { if (!pTscObj) {
continue; continue;
} }
if (!pRsp) {
for (int32_t j = 0; j < TARRAY_SIZE(batchRsp->pArray); ++j) { for (int32_t j = 0; j < TARRAY_SIZE(batchRsp->pArray); ++j) {
SGetUserAuthRsp *rsp = TARRAY_GET_ELEM(batchRsp->pArray, j); SGetUserAuthRsp *rsp = TARRAY_GET_ELEM(batchRsp->pArray, j);
if (0 == strncmp(rsp->user, pTscObj->user, TSDB_USER_LEN)) { if (0 == strncmp(rsp->user, pTscObj->user, TSDB_USER_LEN)) {
pTscObj->authVer = rsp->version; pRsp = rsp;
break;
}
}
}
if (pRsp) {
pTscObj->authVer = pRsp->version;
if (pTscObj->sysInfo != rsp->sysInfo) { if (pTscObj->sysInfo != pRsp->sysInfo) {
tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, rsp->user, tscDebug("update sysInfo of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, pRsp->user,
pTscObj->sysInfo, rsp->sysInfo, pTscObj->id); pTscObj->sysInfo, pRsp->sysInfo, pTscObj->id);
pTscObj->sysInfo = rsp->sysInfo; pTscObj->sysInfo = pRsp->sysInfo;
} }
if (pTscObj->passInfo.fp) { if (pTscObj->passInfo.fp) {
SPassInfo *passInfo = &pTscObj->passInfo; SPassInfo *passInfo = &pTscObj->passInfo;
int32_t oldVer = atomic_load_32(&passInfo->ver); int32_t oldVer = atomic_load_32(&passInfo->ver);
if (oldVer < rsp->passVer) { if (oldVer < pRsp->passVer) {
atomic_store_32(&passInfo->ver, rsp->passVer); atomic_store_32(&passInfo->ver, pRsp->passVer);
if (passInfo->fp) { if (passInfo->fp) {
(*passInfo->fp)(passInfo->param, &rsp->passVer, TAOS_NOTIFY_PASSVER); (*passInfo->fp)(passInfo->param, &pRsp->passVer, TAOS_NOTIFY_PASSVER);
} }
tscDebug("update passVer of user %s from %d to %d, tscRid:%" PRIi64, rsp->user, oldVer, tscDebug("update passVer of user %s from %d to %d, tscRid:%" PRIi64, pRsp->user, oldVer,
atomic_load_32(&passInfo->ver), pTscObj->id); atomic_load_32(&passInfo->ver), pTscObj->id);
} }
} }
} else {
releaseTscObj(pReq->connKey.tscRid);
break; break;
} }
}
releaseTscObj(pReq->connKey.tscRid); releaseTscObj(pReq->connKey.tscRid);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册