提交 d7dc176e 编写于 作者: dengyihao's avatar dengyihao

fix: limit session num

上级 c7e15291
...@@ -582,11 +582,16 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key) { ...@@ -582,11 +582,16 @@ static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key) {
SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key));
STrans* pTranInst = pThrd->pTransInst; STrans* pTranInst = pThrd->pTransInst;
if (plist == NULL) { if (plist == NULL) {
SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
QUEUE_INIT(&nList->msgQ);
nList->numOfConn++;
SConnList list = {0}; SConnList list = {0};
QUEUE_INIT(&list.conns);
list.list = nList;
taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list));
plist = taosHashGet((SHashObj*)pool, key, strlen(key)); plist = taosHashGet((SHashObj*)pool, key, strlen(key));
if (plist == NULL) return NULL;
QUEUE_INIT(&plist->conns);
} }
SMsgList* msglist = plist->list; SMsgList* msglist = plist->list;
...@@ -613,17 +618,17 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) { ...@@ -613,17 +618,17 @@ static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) {
STrans* pTransInst = pThrd->pTransInst; STrans* pTransInst = pThrd->pTransInst;
SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key)); SConnList* plist = taosHashGet((SHashObj*)pool, key, strlen(key));
if (plist == NULL) { if (plist == NULL) {
SConnList list = {0};
SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList)); SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
nList->numOfConn++;
QUEUE_INIT(&nList->msgQ); QUEUE_INIT(&nList->msgQ);
nList->numOfConn++;
SConnList list = {0};
QUEUE_INIT(&list.conns);
list.list = nList; list.list = nList;
taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list)); taosHashPut((SHashObj*)pool, key, strlen(key), (void*)&list, sizeof(list));
plist = taosHashGet((SHashObj*)pool, key, strlen(key)); plist = taosHashGet((SHashObj*)pool, key, strlen(key));
QUEUE_INIT(&plist->conns);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册