fix count error

This commit is contained in:
yihaoDeng 2024-03-05 07:42:29 +00:00
parent d2855bfd68
commit 35c5dca341
1 changed files with 10 additions and 9 deletions

View File

@ -584,8 +584,8 @@ void* destroyConnPool(SCliThrd* pThrd) {
static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) { static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) {
void* pool = pThrd->pool; void* pool = pThrd->pool;
SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1);
STrans* pTranInst = pThrd->pTransInst; STrans* pTranInst = pThrd->pTransInst;
SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key) + 1);
if (plist == NULL) { if (plist == NULL) {
SConnList list = {0}; SConnList list = {0};
taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list)); taosHashPut((SHashObj*)pool, key, strlen(key) + 1, (void*)&list, sizeof(list));
@ -867,17 +867,18 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
QUEUE_INIT(&conn->q); QUEUE_INIT(&conn->q);
conn->broken = true; conn->broken = true;
if (conn->list == NULL) {
conn->list = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr));
}
if (conn->list != NULL) { if (conn->list) {
SConnList* connList = conn->list; SConnList* list = conn->list;
connList->list->numOfConn--; list->list->numOfConn--;
connList->size--; if (conn->status == ConnInPool) {
} else { list->size--;
if (pThrd->pool) {
SConnList* connList = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr) + 1);
if (connList != NULL) connList->list->numOfConn--;
} }
} }
conn->list = NULL; conn->list = NULL;
pThrd->newConnCount--; pThrd->newConnCount--;