rm idle conn
This commit is contained in:
parent
607c042a2f
commit
87a15d4523
|
@ -187,7 +187,7 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
|
|||
pThrd = (SCliThrd*)(exh)->pThrd; \
|
||||
} \
|
||||
} while (0)
|
||||
#define CONN_PERSIST_TIME(para) (para * 20)
|
||||
#define CONN_PERSIST_TIME(para) ((para) == 0 ? 3 * 1000 : 10 * (para))
|
||||
#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
|
||||
#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
|
||||
#define CONN_SHOULD_RELEASE(conn, head) \
|
||||
|
@ -1078,7 +1078,8 @@ static void doCloseIdleConn(void* param) {
|
|||
STaskArg* arg = param;
|
||||
SCliConn* conn = arg->param1;
|
||||
SCliThrd* pThrd = arg->param2;
|
||||
|
||||
tTrace("%s conn %p idle, close it", CONN_GET_INST_LABEL(conn), conn);
|
||||
conn->task = NULL;
|
||||
cliDestroyConn(conn, true);
|
||||
taosMemoryFree(arg);
|
||||
}
|
||||
|
|
|
@ -152,16 +152,19 @@ static bool addHandleToAcceptloop(void* arg);
|
|||
#define CONN_SHOULD_RELEASE(conn, head) \
|
||||
do { \
|
||||
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
|
||||
reallocConnRef(conn); \
|
||||
tTrace("conn %p received release request", conn); \
|
||||
\
|
||||
STraceId traceId = head->traceId; \
|
||||
conn->status = ConnRelease; \
|
||||
transClearBuffer(&conn->readBuf); \
|
||||
transFreeMsg(transContFromHead((char*)head)); \
|
||||
tTrace("conn %p received release request", conn); \
|
||||
STransMsg tmsg = {.code = 0, .info.handle = (void*)conn, .info.traceId = head->traceId, .info.ahandle = NULL}; \
|
||||
\
|
||||
STransMsg tmsg = {.code = 0, .info.handle = (void*)conn, .info.traceId = traceId, .info.ahandle = NULL}; \
|
||||
SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg)); \
|
||||
srvMsg->msg = tmsg; \
|
||||
srvMsg->type = Release; \
|
||||
srvMsg->pConn = conn; \
|
||||
reallocConnRef(conn); \
|
||||
if (!transQueuePush(&conn->srvMsgs, srvMsg)) { \
|
||||
return; \
|
||||
} \
|
||||
|
|
Loading…
Reference in New Issue