提交 156fa5d4 编写于 作者: S slguan

compile for rpc rename index

上级 15506d57
......@@ -62,7 +62,7 @@ void tscPrintMgmtIp() {
void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
tscMgmtIpList.numOfIps = htons(pIpList->numOfIps);
tscMgmtIpList.index = htons(pIpList->index);
tscMgmtIpList.inUse = htons(pIpList->inUse);
tscMgmtIpList.port = htons(pIpList->port);
for (int32_t i = 0; i <tscMgmtIpList.numOfIps; ++i) {
tscMgmtIpList.ip[i] = pIpList->ip[i];
......@@ -72,7 +72,7 @@ void tscSetMgmtIpListFromCluster(SRpcIpSet *pIpList) {
void tscSetMgmtIpListFromEdge() {
if (tscMgmtIpList.numOfIps != 1) {
tscMgmtIpList.numOfIps = 1;
tscMgmtIpList.index = 0;
tscMgmtIpList.inUse = 0;
tscMgmtIpList.port = tsMgmtShellPort;
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
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]) {
tscMgmtIpList.index = 0;
tscMgmtIpList.inUse = 0;
tscMgmtIpList.port = tsMgmtShellPort;
tscMgmtIpList.numOfIps = 1;
tscMgmtIpList.ip[0] = inet_addr(ip);
......
......@@ -150,7 +150,7 @@ void taos_init_imp() {
taosInitNote(tsNumOfLogLines / 10, 1, (char*)"tsc_note");
}
tscMgmtIpList.index = 0;
tscMgmtIpList.inUse = 0;
tscMgmtIpList.port = tsMgmtShellPort;
tscMgmtIpList.numOfIps = 1;
tscMgmtIpList.ip[0] = inet_addr(tsMasterIp);
......
......@@ -944,7 +944,7 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
SRpcConnInfo connInfo;
rpcGetConnInfo(ahandle, &connInfo);
pHBRsp->ipList.index = 0;
pHBRsp->ipList.inUse = 0;
pHBRsp->ipList.port = htons(tsMgmtShellPort);
pHBRsp->ipList.numOfIps = 0;
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
......@@ -1035,7 +1035,7 @@ static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle
strcpy(pConnectRsp->serverVersion, version);
pConnectRsp->writeAuth = pUser->writeAuth;
pConnectRsp->superAuth = pUser->superAuth;
pConnectRsp->ipList.index = 0;
pConnectRsp->ipList.inUse = 0;
pConnectRsp->ipList.port = htons(tsMgmtShellPort);
pConnectRsp->ipList.numOfIps = 0;
if (pSdbPublicIpList != NULL && pSdbIpList != NULL) {
......
......@@ -24,6 +24,7 @@
#include "mgmtTable.h"
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 *mgmtUserActionInsert(void *row, char *str, int32_t size, int32_t *ssize);
......@@ -59,7 +60,10 @@ int32_t mgmtInitUsers() {
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) {
mError("failed to init user data");
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) {
SUserObj *pUser = (SUserObj *) row;
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
if (size < tsize) {
if (size < tsUserUpdateSize) {
*ssize = -1;
} else {
memcpy(str, pUser, tsize);
*ssize = tsize;
memcpy(str, pUser, tsUserUpdateSize);
*ssize = tsUserUpdateSize;
}
return NULL;
......@@ -281,8 +284,7 @@ void *mgmtUserActionDecode(void *row, char *str, int32_t size, int32_t *ssize) {
if (pUser == NULL) return NULL;
memset(pUser, 0, sizeof(SUserObj));
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
memcpy(pUser, str, tsize);
memcpy(pUser, str, tsUserUpdateSize);
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) {
SUserObj *pUser = (SUserObj *)row;
int32_t tsize = pUser->updateEnd - (int8_t *) pUser;
memcpy(pUser, str, tsize);
memcpy(pUser, str, tsUserUpdateSize);
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册