refactor transport

This commit is contained in:
Yihao Deng 2024-05-08 10:16:10 +00:00
parent 4d3be8129e
commit 29215d2411
2 changed files with 6 additions and 11 deletions

View File

@ -113,7 +113,6 @@ typedef struct SCliThrd {
uint64_t nextTimeout; // next timeout
void* pTransInst; //
int connCount;
void (*destroyAhandleFp)(void* ahandle);
SHashObj* fqdn2ipCache;
SCvtAddr cvtAddr;
@ -915,7 +914,6 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
conn->broken = false;
transRefCliHandle(conn);
atomic_add_fetch_32(&pThrd->connCount, 1);
allocConnRef(conn, false);
return conn;
@ -977,8 +975,6 @@ static void cliDestroy(uv_handle_t* handle) {
conn->timer = NULL;
}
atomic_sub_fetch_32(&pThrd->connCount, 1);
transReleaseExHandle(transGetRefMgt(), conn->refId);
transRemoveExHandle(transGetRefMgt(), conn->refId);
taosMemoryFree(conn->dstAddr);
@ -2002,10 +1998,8 @@ static FORCE_INLINE void destroyCmsg(void* arg) {
taosMemoryFree(pMsg);
}
static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param) {
if (arg == NULL) return;
SCliMsg* pMsg = arg;
if (pMsg == NULL) {
return;
}
SCliThrd* pThrd = param;
if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL) {
@ -2335,9 +2329,9 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
// code, msgType
// A: epset, leader, not self
// B: epset, not know leader
// C: no epset, leader but not serivce
// A: epset,leader, not self
// B: epset,not know leader
// C: noepset,leader but not serivce
bool noDelay = false;
if (code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {

View File

@ -676,7 +676,8 @@ static FORCE_INLINE void destroySmsg(SSvrMsg* smsg) {
taosMemoryFree(smsg);
}
static FORCE_INLINE void destroySmsgWrapper(void* smsg, void* param) { destroySmsg((SSvrMsg*)smsg); }
static void destroyAllConn(SWorkThrd* pThrd) {
static void destroyAllConn(SWorkThrd* pThrd) {
tTrace("thread %p destroy all conn ", pThrd);
while (!QUEUE_IS_EMPTY(&pThrd->conn)) {
queue* h = QUEUE_HEAD(&pThrd->conn);