fix(rpc): avoid fd leak

This commit is contained in:
yihaoDeng 2022-05-13 13:09:34 +08:00
parent c56b0e0b15
commit fee540c1fa
1 changed files with 20 additions and 19 deletions

View File

@ -169,7 +169,8 @@ 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) && conn->status == ConnAcquire) { \ if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
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); \