fix(rpc): avoid fd leak
This commit is contained in:
parent
d0fe68b0e4
commit
c56b0e0b15
|
@ -169,8 +169,7 @@ 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); \
|
||||||
|
@ -180,6 +179,7 @@ static bool addHandleToAcceptloop(void* arg);
|
||||||
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; \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in New Issue