From 6000e2e20b25c4fbfa3d6b1f35449bd3f1f5951b Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 28 Jun 2022 11:45:20 +0800 Subject: [PATCH] fix: fix rpc quit problem --- source/libs/transport/src/transCli.c | 2 +- source/libs/transport/src/transSvr.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index c960cb4c63..4535150240 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -601,7 +601,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { QUEUE_INIT(&conn->conn); transRemoveExHandle(conn->refId); if (clear) { - if (uv_is_active((uv_handle_t*)conn->stream)) { + if (!uv_is_closing((uv_handle_t*)conn->stream)) { uv_close((uv_handle_t*)conn->stream, cliDestroy); } else { cliDestroy((uv_handle_t*)conn->stream); diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index f1937c93fe..8bd1c09042 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -431,10 +431,14 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { } static void uvStartSendRespInternal(SSvrMsg* smsg) { + SSvrConn* pConn = smsg->pConn; + if (pConn->broken) { + return; + } + uv_buf_t wb; uvPrepareSendData(smsg, &wb); - SSvrConn* pConn = smsg->pConn; // uv_timer_stop(&pConn->pTimer); uv_write(&pConn->pWriter, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb); } -- GitLab