compile for rpc rename index
This commit is contained in:
parent
15506d57b4
commit
156fa5d4c9
|
@ -62,7 +62,7 @@ void tscPrintMgmtIp() {
|
||||||
|
|
||||||
void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
|
void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
|
||||||
tscMgmtIpList.numOfIps = htons(pIpList->numOfIps);
|
tscMgmtIpList.numOfIps = htons(pIpList->numOfIps);
|
||||||
tscMgmtIpList.index = htons(pIpList->index);
|
tscMgmtIpList.inUse = htons(pIpList->inUse);
|
||||||
tscMgmtIpList.port = htons(pIpList->port);
|
tscMgmtIpList.port = htons(pIpList->port);
|
||||||
for (int32_t i = 0; i <tscMgmtIpList.numOfIps; ++i) {
|
for (int32_t i = 0; i <tscMgmtIpList.numOfIps; ++i) {
|
||||||
tscMgmtIpList.ip[i] = pIpList->ip[i];
|
tscMgmtIpList.ip[i] = pIpList->ip[i];
|
||||||
|
@ -72,7 +72,7 @@ void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
|
||||||
void tscSetMgmtIpListFromEdge() {
|
void tscSetMgmtIpListFromEdge() {
|
||||||
if (tscMgmtIpList.numOfIps != 1) {
|
if (tscMgmtIpList.numOfIps != 1) {
|
||||||
tscMgmtIpList.numOfIps = 1;
|
tscMgmtIpList.numOfIps = 1;
|
||||||
tscMgmtIpList.index = 0;
|
tscMgmtIpList.inUse = 0;
|
||||||
tscMgmtIpList.port = tsMgmtShellPort;
|
tscMgmtIpList.port = tsMgmtShellPort;
|
||||||
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
|
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
|
||||||
tscTrace("edge mgmt IP list:");
|
tscTrace("edge mgmt IP list:");
|
||||||
|
|
|
@ -65,7 +65,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ip && ip[0]) {
|
if (ip && ip[0]) {
|
||||||
tscMgmtIpList.index = 0;
|
tscMgmtIpList.inUse = 0;
|
||||||
tscMgmtIpList.port = tsMgmtShellPort;
|
tscMgmtIpList.port = tsMgmtShellPort;
|
||||||
tscMgmtIpList.numOfIps = 1;
|
tscMgmtIpList.numOfIps = 1;
|
||||||
tscMgmtIpList.ip[0] = inet_addr(ip);
|
tscMgmtIpList.ip[0] = inet_addr(ip);
|
||||||
|
|
|
@ -150,7 +150,7 @@ void taos_init_imp() {
|
||||||
taosInitNote(tsNumOfLogLines / 10, 1, (char*)"tsc_note");
|
taosInitNote(tsNumOfLogLines / 10, 1, (char*)"tsc_note");
|
||||||
}
|
}
|
||||||
|
|
||||||
tscMgmtIpList.index = 0;
|
tscMgmtIpList.inUse = 0;
|
||||||
tscMgmtIpList.port = tsMgmtShellPort;
|
tscMgmtIpList.port = tsMgmtShellPort;
|
||||||
tscMgmtIpList.numOfIps = 1;
|
tscMgmtIpList.numOfIps = 1;
|
||||||
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
|
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
|
||||||
|
|
|
@ -944,7 +944,7 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||||
SRpcConnInfo connInfo;
|
SRpcConnInfo connInfo;
|
||||||
rpcGetConnInfo(ahandle, &connInfo);
|
rpcGetConnInfo(ahandle, &connInfo);
|
||||||
|
|
||||||
pHBRsp->ipList.index = 0;
|
pHBRsp->ipList.inUse = 0;
|
||||||
pHBRsp->ipList.port = htons(tsMgmtShellPort);
|
pHBRsp->ipList.port = htons(tsMgmtShellPort);
|
||||||
pHBRsp->ipList.numOfIps = 0;
|
pHBRsp->ipList.numOfIps = 0;
|
||||||
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
|
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
|
||||||
|
@ -1035,7 +1035,7 @@ static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle
|
||||||
strcpy(pConnectRsp->serverVersion, version);
|
strcpy(pConnectRsp->serverVersion, version);
|
||||||
pConnectRsp->writeAuth = pUser->writeAuth;
|
pConnectRsp->writeAuth = pUser->writeAuth;
|
||||||
pConnectRsp->superAuth = pUser->superAuth;
|
pConnectRsp->superAuth = pUser->superAuth;
|
||||||
pConnectRsp->ipList.index = 0;
|
pConnectRsp->ipList.inUse = 0;
|
||||||
pConnectRsp->ipList.port = htons(tsMgmtShellPort);
|
pConnectRsp->ipList.port = htons(tsMgmtShellPort);
|
||||||
pConnectRsp->ipList.numOfIps = 0;
|
pConnectRsp->ipList.numOfIps = 0;
|
||||||
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
|
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mgmtTable.h"
|
#include "mgmtTable.h"
|
||||||
|
|
||||||
void *tsUserSdb = NULL;
|
void *tsUserSdb = NULL;
|
||||||
|
static int32_t tsUserUpdateSize = 0;
|
||||||
|
|
||||||
void *(*mgmtUserActionFp[SDB_MAX_ACTION_TYPES])(void *row, char *str, int32_t size, int32_t *ssize);
|
void *(*mgmtUserActionFp[SDB_MAX_ACTION_TYPES])(void *row, char *str, int32_t size, int32_t *ssize);
|
||||||
void *mgmtUserActionInsert(void *row, char *str, int32_t size, int32_t *ssize);
|
void *mgmtUserActionInsert(void *row, char *str, int32_t size, int32_t *ssize);
|
||||||
|
@ -59,7 +60,10 @@ int32_t mgmtInitUsers() {
|
||||||
|
|
||||||
mgmtUserActionInit();
|
mgmtUserActionInit();
|
||||||
|
|
||||||
tsUserSdb = sdbOpenTable(tsMaxUsers, sizeof(SUserObj), "user", SDB_KEYTYPE_STRING, tsMgmtDirectory, mgmtUserAction);
|
SUserObj tObj;
|
||||||
|
tsUserUpdateSize = tObj.updateEnd - (int8_t *)&tObj;
|
||||||
|
|
||||||
|
tsUserSdb = sdbOpenTable(tsMaxUsers, tsUserUpdateSize, "user", SDB_KEYTYPE_STRING, tsMgmtDirectory, mgmtUserAction);
|
||||||
if (tsUserSdb == NULL) {
|
if (tsUserSdb == NULL) {
|
||||||
mError("failed to init user data");
|
mError("failed to init user data");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -265,12 +269,11 @@ void *mgmtUserActionUpdate(void *row, char *str, int32_t size, int32_t *ssize) {
|
||||||
void *mgmtUserActionEncode(void *row, char *str, int32_t size, int32_t *ssize) {
|
void *mgmtUserActionEncode(void *row, char *str, int32_t size, int32_t *ssize) {
|
||||||
SUserObj *pUser = (SUserObj *) row;
|
SUserObj *pUser = (SUserObj *) row;
|
||||||
|
|
||||||
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
|
if (size < tsUserUpdateSize) {
|
||||||
if (size < tsize) {
|
|
||||||
*ssize = -1;
|
*ssize = -1;
|
||||||
} else {
|
} else {
|
||||||
memcpy(str, pUser, tsize);
|
memcpy(str, pUser, tsUserUpdateSize);
|
||||||
*ssize = tsize;
|
*ssize = tsUserUpdateSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -281,8 +284,7 @@ void *mgmtUserActionDecode(void *row, char *str, int32_t size, int32_t *ssize) {
|
||||||
if (pUser == NULL) return NULL;
|
if (pUser == NULL) return NULL;
|
||||||
memset(pUser, 0, sizeof(SUserObj));
|
memset(pUser, 0, sizeof(SUserObj));
|
||||||
|
|
||||||
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
|
memcpy(pUser, str, tsUserUpdateSize);
|
||||||
memcpy(pUser, str, tsize);
|
|
||||||
|
|
||||||
return (void *)pUser;
|
return (void *)pUser;
|
||||||
}
|
}
|
||||||
|
@ -290,8 +292,7 @@ void *mgmtUserActionDecode(void *row, char *str, int32_t size, int32_t *ssize) {
|
||||||
void *mgmtUserActionReset(void *row, char *str, int32_t size, int32_t *ssize) {
|
void *mgmtUserActionReset(void *row, char *str, int32_t size, int32_t *ssize) {
|
||||||
SUserObj *pUser = (SUserObj *)row;
|
SUserObj *pUser = (SUserObj *)row;
|
||||||
|
|
||||||
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
|
memcpy(pUser, str, tsUserUpdateSize);
|
||||||
memcpy(pUser, str, tsize);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue