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

fix: fix compile error

上级 440d14e3
...@@ -1419,37 +1419,37 @@ void transUnrefCliHandle(void* handle) { ...@@ -1419,37 +1419,37 @@ void transUnrefCliHandle(void* handle) {
cliDestroyConn((SCliConn*)handle, true); cliDestroyConn((SCliConn*)handle, true);
} }
} }
static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(int64_t handle, bool* validHandle) { static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t handle) {
SCliThrd* pThrd = NULL; SCliThrd* pThrd = NULL;
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle); SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
if (exh == NULL) { if (exh == NULL) {
return NULL; return NULL;
} }
*validHandle = true; if (exh->pThrd == NULL && trans != NULL) {
int idx = cliRBChoseIdx(trans);
if (idx < 0) return NULL;
exh->pThrd = ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
}
pThrd = exh->pThrd; pThrd = exh->pThrd;
transReleaseExHandle(transGetRefMgt(), handle); transReleaseExHandle(transGetRefMgt(), handle);
return pThrd; return pThrd;
} }
SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle, bool* validHandle) { SCliThrd* transGetWorkThrd(STrans* trans, int64_t handle) {
if (handle == 0) { if (handle == 0) {
int idx = cliRBChoseIdx(trans); int idx = cliRBChoseIdx(trans);
if (idx < 0) return NULL; if (idx < 0) return NULL;
return ((SCliObj*)trans->tcphandle)->pThreadObj[idx]; return ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
} }
SCliThrd* pThrd = transGetWorkThrdFromHandle(handle, validHandle); SCliThrd* pThrd = transGetWorkThrdFromHandle(trans, handle);
// if (pThrd == NULL) {
// int idx = cliRBChoseIdx(trans);
// if (idx < 0) return NULL;
// pThrd = ((SCliObj*)trans->tcphandle)->pThreadObj[idx];
// }
return pThrd; return pThrd;
} }
int transReleaseCliHandle(void* handle) { int transReleaseCliHandle(void* handle) {
int idx = -1; int idx = -1;
bool valid = false; bool valid = false;
SCliThrd* pThrd = transGetWorkThrdFromHandle((int64_t)handle, &valid); SCliThrd* pThrd = transGetWorkThrdFromHandle(NULL, (int64_t)handle);
if (pThrd == NULL) { if (pThrd == NULL) {
return -1; return -1;
} }
...@@ -1482,8 +1482,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran ...@@ -1482,8 +1482,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
return -1; return -1;
} }
bool valid = false; SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle, &valid);
if (pThrd == NULL) { if (pThrd == NULL) {
transFreeMsg(pReq->pCont); transFreeMsg(pReq->pCont);
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
...@@ -1527,9 +1526,8 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs ...@@ -1527,9 +1526,8 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
return -1; return -1;
} }
bool valid = false; SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle, &valid); if (pThrd == NULL) {
if (pThrd == NULL && valid == false) {
transFreeMsg(pReq->pCont); transFreeMsg(pReq->pCont);
transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle);
return TSDB_CODE_RPC_BROKEN_LINK; return TSDB_CODE_RPC_BROKEN_LINK;
...@@ -1613,6 +1611,7 @@ int64_t transAllocHandle() { ...@@ -1613,6 +1611,7 @@ int64_t transAllocHandle() {
SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle)); SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle));
exh->refId = transAddExHandle(transGetRefMgt(), exh); exh->refId = transAddExHandle(transGetRefMgt(), exh);
tDebug("pre alloc refId %" PRId64 "", exh->refId); tDebug("pre alloc refId %" PRId64 "", exh->refId);
return exh->refId; return exh->refId;
} }
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册