refactor code
This commit is contained in:
parent
c5675bc821
commit
c875805874
|
@ -1,4 +1,5 @@
|
||||||
/** Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
/** Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can use, redistribute, and/or modify
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License, version 3
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
@ -809,7 +810,7 @@ SCliConn* cliGetConn(SCliMsg* pMsg, SCliThrd* pThrd, bool* ignore) {
|
||||||
conn = exh->handle;
|
conn = exh->handle;
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
conn = getConnFromPool(pThrd->pool, EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet));
|
conn = getConnFromPool(pThrd->pool, EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet));
|
||||||
*ignore = (conn && 0 == specifyConnRef(conn, true, refId)) ? false : true;
|
if (conn != NULL) specifyConnRef(conn, true, refId);
|
||||||
}
|
}
|
||||||
transReleaseExHandle(transGetRefMgt(), refId);
|
transReleaseExHandle(transGetRefMgt(), refId);
|
||||||
}
|
}
|
||||||
|
@ -849,14 +850,20 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
SCliConn* conn = cliGetConn(pMsg, pThrd, &ignore);
|
SCliConn* conn = cliGetConn(pMsg, pThrd, &ignore);
|
||||||
if (ignore == true) {
|
if (ignore == true) {
|
||||||
|
tError("ignore msg");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn != NULL) {
|
if (conn != NULL) {
|
||||||
transCtxMerge(&conn->ctx, &pCtx->appCtx);
|
transCtxMerge(&conn->ctx, &pCtx->appCtx);
|
||||||
transQueuePush(&conn->cliMsgs, pMsg);
|
transQueuePush(&conn->cliMsgs, pMsg);
|
||||||
cliSend(conn);
|
cliSend(conn);
|
||||||
} else {
|
} else {
|
||||||
conn = cliCreateConn(pThrd);
|
conn = cliCreateConn(pThrd);
|
||||||
|
|
||||||
|
int64_t refId = (int64_t)pMsg->msg.info.handle;
|
||||||
|
if (refId != 0) specifyConnRef(conn, true, refId);
|
||||||
|
|
||||||
transCtxMerge(&conn->ctx, &pCtx->appCtx);
|
transCtxMerge(&conn->ctx, &pCtx->appCtx);
|
||||||
transQueuePush(&conn->cliMsgs, pMsg);
|
transQueuePush(&conn->cliMsgs, pMsg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue