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

fix(rpc): avoid fd leak

上级 d0fe68b0
...@@ -167,25 +167,25 @@ static void* transAcceptThread(void* arg); ...@@ -167,25 +167,25 @@ static void* transAcceptThread(void* arg);
static bool addHandleToWorkloop(SWorkThrdObj* pThrd, char* pipeName); static bool addHandleToWorkloop(SWorkThrdObj* pThrd, char* pipeName);
static bool addHandleToAcceptloop(void* arg); static bool addHandleToAcceptloop(void* arg);
#define CONN_SHOULD_RELEASE(conn, head) \ #define CONN_SHOULD_RELEASE(conn, head) \
do { \ do { \
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \ if ((head)->release == 1 && (head->msgLen) == sizeof(*head) && conn->status == ConnAcquire) { \
conn->status = ConnRelease; \ transClearBuffer(&conn->readBuf); \
transClearBuffer(&conn->readBuf); \ transFreeMsg(transContFromHead((char*)head)); \
transFreeMsg(transContFromHead((char*)head)); \ tTrace("server conn %p received release request", conn); \
tTrace("server conn %p received release request", conn); \ \
\ STransMsg tmsg = {.code = 0, .handle = (void*)conn, .ahandle = NULL}; \
STransMsg tmsg = {.code = 0, .handle = (void*)conn, .ahandle = NULL}; \ SSrvMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSrvMsg)); \
SSrvMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSrvMsg)); \ srvMsg->msg = tmsg; \
srvMsg->msg = tmsg; \ srvMsg->type = Release; \
srvMsg->type = Release; \ srvMsg->pConn = conn; \
srvMsg->pConn = conn; \ reallocConnRefHandle(conn); \
if (!transQueuePush(&conn->srvMsgs, srvMsg)) { \ if (!transQueuePush(&conn->srvMsgs, srvMsg)) { \
return; \ return; \
} \ } \
uvStartSendRespInternal(srvMsg); \ uvStartSendRespInternal(srvMsg); \
return; \ return; \
} \ } \
} while (0) } while (0)
#define SRV_RELEASE_UV(loop) \ #define SRV_RELEASE_UV(loop) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册