提交 34145487 编写于 作者: Y yihaoDeng

share mgmt ep set

上级 19c3c7c6
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册