提交 d774aa39 编写于 作者: S slguan

[TBASE-1241]

上级 1475d520
......@@ -2643,9 +2643,6 @@ int tscBuildConnectMsg(SSqlObj *pSql) {
strcpy(pConnect->db, db);
strcpy(pConnect->clientVersion, version);
pConnect->usePublicIp = (int8_t)tsUsePublicIp;
pConnect->isCluster = (int8_t)tsIsCluster;
memset(pConnect->reserved, 0, sizeof(pConnect->reserved));
pMsg += sizeof(SConnectMsg);
......
......@@ -224,7 +224,9 @@ typedef struct {
uint32_t destId;
char meterId[TSDB_UNI_LEN];
uint16_t port; // for UDP only
char empty[1];
uint8_t usePublicIp : 1;
uint8_t isCluster : 1;
uint8_t empty : 6;
uint8_t msgType;
int32_t msgLen;
uint8_t content[0];
......@@ -352,9 +354,6 @@ typedef struct {
typedef struct {
char clientVersion[TSDB_VERSION_LEN];
char db[TSDB_METER_ID_LEN];
int8_t usePublicIp;
int8_t isCluster;
int8_t reserved[14];
} SConnectMsg;
typedef struct {
......@@ -667,8 +666,11 @@ typedef struct {
typedef struct {
uint32_t destId;
char meterId[TSDB_UNI_LEN];
char empty[3];
char msgType;
uint16_t port; // for UDP only
uint8_t usePublicIp : 1;
uint8_t isCluster : 1;
uint8_t empty : 6;
uint8_t msgType;
int32_t msgLen;
uint8_t content[0];
} SIntMsg;
......
......@@ -246,6 +246,8 @@ char *taosBuildReqHeader(void *param, char type, char *msg) {
pHeader->destId = pConn->peerId;
pHeader->port = 0;
pHeader->uid = (uint32_t)pConn + (uint32_t)getpid();
pHeader->usePublicIp = (tsUsePublicIp == 0 ? 0 : 1);
pHeader->isCluster = (tsIsCluster == 0 ? 0 : 1);
memcpy(pHeader->meterId, pConn->meterId, tListLen(pHeader->meterId));
......
......@@ -223,7 +223,8 @@ typedef struct _connObj {
char writeAuth : 1; // write flag
char killConnection : 1; // kill the connection flag
char usePublicIp : 1; // if the connection request is publicIp
char reserved : 4;
char isCluster : 1;
char reserved : 3;
uint32_t queryId; // query ID to be killed
uint32_t streamId; // stream ID to be killed
uint32_t ip; // shell IP
......
......@@ -1201,8 +1201,8 @@ int mgmtProcessConnectMsg(char *pMsg, int msgLen, SConnObj *pConn) {
goto _rsp;
}
if (pConnectMsg->isCluster != tsIsCluster) {
mError("Cluster Edition and lite Edition cannot be interconnected, client:%d server:%d", pConnectMsg->isCluster, tsIsCluster);
if (pConn->isCluster != tsIsCluster) {
mError("Cluster Edition and lite Edition cannot be interconnected, client:%d server:%d", pConn->isCluster, tsIsCluster);
code = TSDB_CODE_INVALID_CLIENT_VERSION;
goto _rsp;
}
......@@ -1246,17 +1246,13 @@ _rsp:
pMsg += sizeof(SConnectRsp);
#ifdef CLUSTER
if (pConnectMsg->usePublicIp) {
pConn->usePublicIp = 1;
int size = pSdbPublicIpList->numOfIps * 4 + sizeof(SIpList);
int size = pSdbPublicIpList->numOfIps * 4 + sizeof(SIpList);
if (pConn->usePublicIp) {
memcpy(pMsg, pSdbPublicIpList, size);
pMsg += size;
}
else {
int size = pSdbIpList->numOfIps * 4 + sizeof(SIpList);
} else {
memcpy(pMsg, pSdbIpList, size);
pMsg += size;
}
pMsg += size;
#endif
// set the time resolution: millisecond or microsecond
......@@ -1305,8 +1301,16 @@ void *mgmtProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
pConn = connList + pMsg->destId;
pConn->thandle = thandle;
strcpy(pConn->user, pMsg->meterId);
uint32_t ip = taosGetRpcLocalIp(thandle);
if (ip == tsPublicIp) {
pConn->usePublicIp = true;
}
}
pConn->usePublicIp = pMsg->usePublicIp;
pConn->isCluster = pMsg->isCluster;
if (pMsg->msgType == TSDB_MSG_TYPE_CONNECT) {
(*mgmtProcessShellMsg[pMsg->msgType])((char *)pMsg->content, pMsg->msgLen - sizeof(SIntMsg), pConn);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册