diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e62a73b7fa2e4b8de3c89956ad3956231a6e92cb..d1debc6af60b844a233797f3cb74135318250793 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -1097,15 +1097,16 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM if (index == -1) { index = cliRBChoseIdx(pTransInst); } + tsem_t* sem = taosMemoryCalloc(1, sizeof(tsem_t)); + tsem_init(sem, 0, 0); STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx)); pCtx->epSet = *pEpSet; pCtx->ahandle = pReq->info.ahandle; pCtx->msgType = pReq->msgType; pCtx->hThrdIdx = index; - pCtx->pSem = taosMemoryCalloc(1, sizeof(tsem_t)); + pCtx->pSem = sem; pCtx->pRsp = pRsp; - tsem_init(pCtx->pSem, 0, 0); SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg)); cliMsg->ctx = pCtx; @@ -1118,10 +1119,9 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle); transSendAsync(thrd->asyncPool, &(cliMsg->q)); - tsem_t* pSem = pCtx->pSem; - tsem_wait(pSem); - tsem_destroy(pSem); - taosMemoryFree(pSem); + tsem_wait(sem); + tsem_destroy(sem); + taosMemoryFree(sem); } /* diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index cfd711e6eb5e4eea58582d18ecf637e27ab0539d..4c4714e248b06de38fcfe883f5a8f08a1d758373 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -226,7 +226,7 @@ static bool addHandleToAcceptloop(void* arg); } else { \ refId = exh1->refId; \ } \ - } else if (refId == -1) { \ + } else if (refId < 0) { \ tTrace("server handle step3"); \ goto _return2; \ } \