fix(rpc): avoid fd leak

This commit is contained in:
yihaoDeng 2022-05-12 15:29:19 +08:00
parent dd8e642f37
commit 4f7886d208
1 changed files with 5 additions and 1 deletions

View File

@ -363,6 +363,10 @@ void uvOnSendCb(uv_write_t* req, int status) {
if (msg->type == Release && conn->status != ConnNormal) { if (msg->type == Release && conn->status != ConnNormal) {
conn->status = ConnNormal; conn->status = ConnNormal;
transUnrefSrvHandle(conn); transUnrefSrvHandle(conn);
reallocConnRefHandle(conn);
destroySmsg(msg);
transQueueClear(&conn->srvMsgs);
return;
} }
destroySmsg(msg); destroySmsg(msg);
// send second data, just use for push // send second data, just use for push
@ -973,7 +977,7 @@ void uvHandleQuit(SSrvMsg* msg, SWorkThrdObj* thrd) {
} }
void uvHandleRelease(SSrvMsg* msg, SWorkThrdObj* thrd) { void uvHandleRelease(SSrvMsg* msg, SWorkThrdObj* thrd) {
SSrvConn* conn = msg->pConn; SSrvConn* conn = msg->pConn;
reallocConnRefHandle(conn); // reallocConnRefHandle(conn);
if (conn->status == ConnAcquire) { if (conn->status == ConnAcquire) {
if (!transQueuePush(&conn->srvMsgs, msg)) { if (!transQueuePush(&conn->srvMsgs, msg)) {
return; return;