提交 5f553934 编写于 作者: dengyihao's avatar dengyihao

fixbug

上级 6163e240
...@@ -48,7 +48,7 @@ void tscIpSetCopy(SRpcIpSet *dst, SRpcIpSet *src) { ...@@ -48,7 +48,7 @@ void tscIpSetCopy(SRpcIpSet *dst, SRpcIpSet *src) {
dst->numOfIps = src->numOfIps; dst->numOfIps = src->numOfIps;
dst->inUse = src->inUse; dst->inUse = src->inUse;
for (int32_t i = 0; i < src->numOfIps; ++i) { for (int32_t i = 0; i < src->numOfIps; ++i) {
dst->port[i] = htons(dst->port[i]); dst->port[i] = src->port[i];
strncpy(dst->fqdn[i], src->fqdn[i], TSDB_FQDN_LEN); strncpy(dst->fqdn[i], src->fqdn[i], TSDB_FQDN_LEN);
} }
} }
...@@ -58,7 +58,11 @@ static void tscDumpMgmtIpSet(SRpcIpSet *ipSet) { ...@@ -58,7 +58,11 @@ static void tscDumpMgmtIpSet(SRpcIpSet *ipSet) {
tscIpSetCopy(ipSet, src); tscIpSetCopy(ipSet, src);
taosCorEndRead(&tscMgmtIpSet.version); taosCorEndRead(&tscMgmtIpSet.version);
} }
static void tscIpSetHtons(SRpcIpSet *s) {
for (int32_t i = 0; i < s->numOfIps; i++) {
s->port[i] = htons(s->port[i]);
}
}
bool tscIpSetIsEqual(SRpcIpSet *s1, SRpcIpSet *s2) { bool tscIpSetIsEqual(SRpcIpSet *s1, SRpcIpSet *s2) {
if (s1->numOfIps != s2->numOfIps /*|| s1->inUse != s1->inUse*/) { if (s1->numOfIps != s2->numOfIps /*|| s1->inUse != s1->inUse*/) {
return false; return false;
...@@ -149,6 +153,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) { ...@@ -149,6 +153,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
SCMHeartBeatRsp *pRsp = (SCMHeartBeatRsp *)pRes->pRsp; SCMHeartBeatRsp *pRsp = (SCMHeartBeatRsp *)pRes->pRsp;
SRpcIpSet * pIpList = &pRsp->ipList; SRpcIpSet * pIpList = &pRsp->ipList;
if (pIpList->numOfIps > 0) if (pIpList->numOfIps > 0)
tscIpSetHtons(pIpList);
tscUpdateMgmtIpList(pIpList); tscUpdateMgmtIpList(pIpList);
pSql->pTscObj->connId = htonl(pRsp->connId); pSql->pTscObj->connId = htonl(pRsp->connId);
...@@ -276,8 +281,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) { ...@@ -276,8 +281,10 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
} }
if (pIpSet) { if (pIpSet) {
if (!tscIpSetIsEqual(&pSql->ipList, pIpSet)) { //SRpcIpSet dump;
if (pCmd->command < TSDB_SQL_MGMT) { tscIpSetHtons(pIpSet);
if (tscIpSetIsEqual(&pSql->ipList, pIpSet)) {
if(pCmd->command < TSDB_SQL_MGMT) {
tscUpdateVgroupInfo(pSql, pIpSet); tscUpdateVgroupInfo(pSql, pIpSet);
} else { } else {
tscUpdateMgmtIpList(pIpSet); tscUpdateMgmtIpList(pIpSet);
...@@ -464,10 +471,8 @@ int tscProcessSql(SSqlObj *pSql) { ...@@ -464,10 +471,8 @@ int tscProcessSql(SSqlObj *pSql) {
return pSql->res.code; return pSql->res.code;
} }
} else if (pCmd->command < TSDB_SQL_LOCAL) { } else if (pCmd->command < TSDB_SQL_LOCAL) {
SRpcIpSet dump; tscDumpMgmtIpSet(&pSql->ipList);
tscDumpMgmtIpSet(&dump); } else {
pSql->ipList = dump;
} else { // local handler
return (*tscProcessMsgRsp[pCmd->command])(pSql); return (*tscProcessMsgRsp[pCmd->command])(pSql);
} }
...@@ -1991,6 +1996,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) { ...@@ -1991,6 +1996,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
tstrncpy(pObj->db, temp, sizeof(pObj->db)); tstrncpy(pObj->db, temp, sizeof(pObj->db));
if (pConnect->ipList.numOfIps > 0) if (pConnect->ipList.numOfIps > 0)
tscIpSetHtons(&pConnect->ipList);
tscUpdateMgmtIpList(&pConnect->ipList); tscUpdateMgmtIpList(&pConnect->ipList);
strcpy(pObj->sversion, pConnect->serverVersion); strcpy(pObj->sversion, pConnect->serverVersion);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册