diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index c11c524f9666ba9f6fa959699c66a7ac7b4a0b71..d6cf9a6553a997d7d4e6c85e0a9d1f17885e54ec 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -385,7 +385,7 @@ void tscSetStreamDestTable(SSqlStream* pStream, const char* dstTable); void *tscAcquireRpc(const char *key); void tscReleaseRpc(void *param); -int32_t tscInitRpc(const char *key, const char *user, const char *secret, void **pRpcObj); +int32_t tscInitRpc(const char *key, const char *user, const char *secret, void **pRpcObj, SRpcCorEpSet *corMgmtEpSet); void tscInitMsgsFp(); int tsParseSql(SSqlObj *pSql, bool initial); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 0f1824c1ed7bcfd0681e6dc9ccaf8e32df865aef..653574c8d0e3e78b8421db80c60a1291ca05e578 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) != 0) { + if (tscInitRpc(rpcKey, user, secretEncrypt, &pRpcObj, &corMgmtEpSet) != 0) { terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL; return NULL; } @@ -107,7 +107,6 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa } pObj->signature = pObj; pObj->pRpcObj = (SRpcObj *)pRpcObj; - memcpy(pObj->pRpcObj->tscCorMgmtEpSet, &corMgmtEpSet, sizeof(SRpcCorEpSet)); tstrncpy(pObj->user, user, sizeof(pObj->user)); secretEncryptLen = MIN(secretEncryptLen, sizeof(pObj->pass)); memcpy(pObj->pass, secretEncrypt, secretEncryptLen); diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index e4a1cbc7d50bcb10609b599e87c22529b4a673c8..41c0ae1badfe0257363bcb3b2a1f69a6a3232145 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -73,7 +73,7 @@ void tscReleaseRpc(void *param) { pthread_mutex_unlock(&rpcObjMutex); } -int32_t tscInitRpc(const char *key, const char *user, const char *secretEncrypt, void **ppRpcObj) { +int32_t tscInitRpc(const char *key, const char *user, const char *secretEncrypt, void **ppRpcObj, SRpcCorEpSet *corMgmtEpSet) { pthread_mutex_lock(&rpcObjMutex); SRpcObj *pRpcObj = (SRpcObj *)tscAcquireRpc(key); @@ -117,6 +117,7 @@ int32_t tscInitRpc(const char *key, const char *user, const char *secretEncrypt, rpcClose(rpcObj.pDnodeConn); pthread_mutex_unlock(&rpcObjMutex); } + memcpy(pRpcObj->tscCorMgmtEpSet, corMgmtEpSet, sizeof(*corMgmtEpSet)); *ppRpcObj = pRpcObj; pthread_mutex_unlock(&rpcObjMutex);