From cb0fcf10d5df213eae20da0d4e96f9e47cee0e1a Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Thu, 5 Nov 2020 14:40:20 +0000 Subject: [PATCH] minor changes --- src/rpc/src/rpcMain.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index a7123f250c..a24894c2bf 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -221,8 +221,7 @@ static void rpcFree(void *p) { free(p); } -static void rpcInit(void) { - +void rpcInit(void) { tsProgressTimer = tsRpcTimer/2; tsRpcMaxRetry = tsRpcMaxTime * 1000/tsProgressTimer; tsRpcHeadSize = RPC_MSG_OVERHEAD; @@ -231,6 +230,11 @@ static void rpcInit(void) { tsRpcRefId = taosOpenRef(200, rpcFree); } +void rpcCleanup(void) { + taosCloseRef(tsRpcRefId); + tsRpcRefId = -1; +} + void *rpcOpen(const SRpcInit *pInit) { SRpcInfo *pRpc; @@ -1621,11 +1625,7 @@ static void rpcDecRef(SRpcInfo *pRpc) tDebug("%s rpc resources are released", pRpc->label); taosTFree(pRpc); - int count = atomic_sub_fetch_32(&tsRpcNum, 1); - if (count == 0) { - // taosCloseRef(tsRpcRefId); - // tsRpcInit = PTHREAD_ONCE_INIT; // windows compliling error - } + atomic_sub_fetch_32(&tsRpcNum, 1); } } -- GitLab