diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index d6cf9a6553a997d7d4e6c85e0a9d1f17885e54ec..8c8e18c825d10e8d91eebee9dc275c2d73e494d1 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -383,10 +383,9 @@ typedef struct SSqlStream { void tscSetStreamDestTable(SSqlStream* pStream, const char* dstTable); -void *tscAcquireRpc(const char *key); +int tscAcquireRpc(const char *key, const char *user, const char *secret, SRpcCorEpSet *corMgmtEpSet, void **pRpcObj); void tscReleaseRpc(void *param); -int32_t tscInitRpc(const char *key, const char *user, const char *secret, void **pRpcObj, SRpcCorEpSet *corMgmtEpSet); -void tscInitMsgsFp(); +void tscInitMsgsFp(); int tsParseSql(SSqlObj *pSql, bool initial); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 653574c8d0e3e78b8421db80c60a1291ca05e578..0730fffdd5eaba1f505ebbd6ce722b976933fd34 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -94,7 +94,7 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa sprintf(rpcKey, "%s:%s:%s:%d", user, pass, ip, port); void *pRpcObj = NULL; - if (tscInitRpc(rpcKey, user, secretEncrypt, &pRpcObj, &corMgmtEpSet) != 0) { + if (tscAcquireRpc(rpcKey, user, secretEncrypt,&corMgmtEpSet, &pRpcObj) != 0) { terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL; return NULL; } diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 41c0ae1badfe0257363bcb3b2a1f69a6a3232145..7a92b4fc0503c9901d243afaca5970237930f600 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -56,13 +56,6 @@ void tscFreeRpcObj(void *param) { rpcClose(pRpcObj->pDnodeConn); tfree(pRpcObj->tscCorMgmtEpSet); } -void *tscAcquireRpc(const char *key) { - SRpcObj *pRpcObj = taosCacheAcquireByKey(tscRpcCache, key, strlen(key)); - if (pRpcObj == NULL) { - return NULL; - } - return pRpcObj; -} void tscReleaseRpc(void *param) { if (param == NULL) { @@ -73,10 +66,10 @@ void tscReleaseRpc(void *param) { pthread_mutex_unlock(&rpcObjMutex); } -int32_t tscInitRpc(const char *key, const char *user, const char *secretEncrypt, void **ppRpcObj, SRpcCorEpSet *corMgmtEpSet) { +int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncrypt, SRpcCorEpSet *corMgmtEpSet, void **ppRpcObj) { pthread_mutex_lock(&rpcObjMutex); - SRpcObj *pRpcObj = (SRpcObj *)tscAcquireRpc(key); + SRpcObj *pRpcObj = (SRpcObj *)taosCacheAcquireByKey(tscRpcCache, key, strlen(key)); if (pRpcObj != NULL) { *ppRpcObj = pRpcObj; pthread_mutex_unlock(&rpcObjMutex);