Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
ce0f8aae
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
ce0f8aae
编写于
2月 21, 2020
作者:
S
slguan
提交者:
GitHub
2月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1249 from taosdata/refact/rpc
add destIp support for NAT
上级
dd78eabd
db1e1e54
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
187 addition
and
193 deletion
+187
-193
src/inc/mnode.h
src/inc/mnode.h
+2
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+24
-10
src/inc/trpc.h
src/inc/trpc.h
+3
-2
src/mnode/inc/mgmtShell.h
src/mnode/inc/mgmtShell.h
+1
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+146
-176
src/rpc/inc/rpcHead.h
src/rpc/inc/rpcHead.h
+1
-0
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+10
-4
未找到文件。
src/inc/mnode.h
浏览文件 @
ce0f8aae
...
...
@@ -254,6 +254,8 @@ typedef struct _user_obj {
char
reserved
[
16
];
char
updateEnd
[
1
];
struct
_user_obj
*
prev
,
*
next
;
int8_t
writeAuth
;
int8_t
superAuth
;
}
SUserObj
;
typedef
struct
{
...
...
src/inc/taosmsg.h
浏览文件 @
ce0f8aae
...
...
@@ -187,6 +187,13 @@ typedef enum {
extern
char
*
taosMsg
[];
#define TSDB_MSG_DEF_MAX_MPEERS 5
#define TSDB_MSG_DEF_VERSION_LEN 64
#define TSDB_MSG_DEF_DB_LEN 128
#define TSDB_MSG_DEF_USER_LEN 128
#define TSDB_MSG_DEF_TABLE_LEN 128
#define TSDB_MSG_DEF_ACCT_LEN 128
#pragma pack(push, 1)
typedef
struct
{
...
...
@@ -325,9 +332,23 @@ typedef struct {
}
SAlterTableMsg
;
typedef
struct
{
char
clientVersion
[
TSDB_VERSION_LEN
];
char
db
[
TSDB_TABLE_ID_LEN
];
}
SConnectMsg
;
char
clientVersion
[
TSDB_MSG_DEF_VERSION_LEN
];
char
msgVersion
[
TSDB_MSG_DEF_VERSION_LEN
];
char
db
[
TSDB_MSG_DEF_DB_LEN
];
}
SCMConnectMsg
;
typedef
struct
{
char
acctId
[
TSDB_MSG_DEF_ACCT_LEN
];
char
serverVersion
[
TSDB_MSG_DEF_VERSION_LEN
];
int8_t
writeAuth
;
int8_t
superAuth
;
int8_t
usePublicIp
;
int16_t
index
;
int16_t
numOfIps
;
uint16_t
port
;
uint32_t
ip
[
TSDB_MSG_DEF_MAX_MPEERS
];
}
SCMConnectRsp
;
typedef
struct
{
int32_t
maxUsers
;
...
...
@@ -360,13 +381,6 @@ typedef struct {
char
db
[
TSDB_TABLE_ID_LEN
];
}
SMgmtHead
;
typedef
struct
{
char
acctId
[
TSDB_ACCT_LEN
];
char
version
[
TSDB_VERSION_LEN
];
char
writeAuth
;
char
superAuth
;
}
SConnectRsp
;
typedef
struct
{
short
vnode
;
int32_t
sid
;
...
...
src/inc/trpc.h
浏览文件 @
ce0f8aae
...
...
@@ -46,8 +46,9 @@ typedef struct {
}
SRpcIpSet
;
typedef
struct
{
uint32_t
sourceIp
;
uint16_t
sourcePort
;
uint32_t
clientIp
;
uint16_t
clientPort
;
uint32_t
serverIp
;
char
*
user
;
}
SRpcConnInfo
;
...
...
src/mnode/inc/mgmtShell.h
浏览文件 @
ce0f8aae
...
...
@@ -24,7 +24,7 @@ extern "C" {
#include <stdbool.h>
#include "mnode.h"
int
mgmtInitShell
();
int
32_t
mgmtInitShell
();
void
mgmtCleanUpShell
();
extern
int32_t
(
*
mgmtCheckRedirectMsg
)(
SConnObj
*
pConn
,
int32_t
msgType
);
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
ce0f8aae
此差异已折叠。
点击以展开。
src/rpc/inc/rpcHead.h
浏览文件 @
ce0f8aae
...
...
@@ -32,6 +32,7 @@ typedef struct {
uint32_t
uid
;
// for unique ID inside a client
uint32_t
sourceId
;
// source ID, an index for connection list
uint32_t
destId
;
// destination ID, an index for connection list
uint32_t
destIp
;
// destination IP address, for NAT scenario
char
user
[
TSDB_UNI_LEN
];
uint16_t
port
;
// for UDP only, port may be changed
char
empty
[
1
];
// reserved
...
...
src/rpc/src/rpcMain.c
浏览文件 @
ce0f8aae
...
...
@@ -94,6 +94,7 @@ typedef struct _RpcConn {
uint16_t
localPort
;
// for UDP only
uint32_t
peerUid
;
// peer UID
uint32_t
peerIp
;
// peer IP
uint32_t
destIp
;
// server destination IP to handle NAT
uint16_t
peerPort
;
// peer port
char
peerIpstr
[
TSDB_IPv4ADDR_LEN
];
// peer IP string
uint16_t
tranId
;
// outgoing transcation ID, for build message
...
...
@@ -389,8 +390,9 @@ void rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo) {
SRpcConn
*
pConn
=
(
SRpcConn
*
)
thandle
;
SRpcInfo
*
pRpc
=
pConn
->
pRpc
;
pInfo
->
sourceIp
=
pConn
->
peerIp
;
pInfo
->
sourcePort
=
pConn
->
peerPort
;
pInfo
->
clientIp
=
pConn
->
peerIp
;
pInfo
->
clientPort
=
pConn
->
peerPort
;
pInfo
->
serverIp
=
pConn
->
destIp
;
strcpy
(
pInfo
->
user
,
pConn
->
user
);
}
...
...
@@ -546,6 +548,7 @@ SRpcConn *rpcSetConnToServer(SRpcInfo *pRpc, SRpcIpSet ipSet) {
char
ipstr
[
20
]
=
{
0
};
tinet_ntoa
(
ipstr
,
ipSet
.
ip
[
ipSet
.
index
]);
pConn
=
rpcOpenConn
(
pRpc
,
ipstr
,
ipSet
.
port
);
pConn
->
destIp
=
ipSet
.
ip
[
ipSet
.
index
];
}
return
pConn
;
...
...
@@ -772,11 +775,13 @@ static void *rpcProcessMsgFromPeer(void *msg, int msgLen, uint32_t ip, uint16_t
static
void
rpcProcessIncomingMsg
(
SRpcConn
*
pConn
,
SRpcHead
*
pHead
)
{
SRpcInfo
*
pRpc
=
pConn
->
pRpc
;
pHead
=
rpcDecompressRpcMsg
(
pHead
);
int
contLen
=
rpcContLenFromMsg
(
pHead
->
msgLen
);
uint8_t
*
pCont
=
pHead
->
content
;
int
contLen
=
rpcContLenFromMsg
(
pHead
->
msgLen
);
uint8_t
*
pCont
=
pHead
->
content
;
if
(
rpcIsReq
(
pHead
->
msgType
)
)
{
pConn
->
destIp
=
pHead
->
destIp
;
taosTmrReset
(
rpcProcessProgressTimer
,
tsRpcTimer
/
2
,
pConn
,
pRpc
->
tmrCtrl
,
&
pConn
->
pTimer
);
(
*
(
pRpc
->
cfp
))(
pHead
->
msgType
,
pCont
,
contLen
,
pConn
,
0
);
}
else
{
...
...
@@ -886,6 +891,7 @@ static void rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) {
pHead
->
tranId
=
pConn
->
tranId
;
pHead
->
sourceId
=
pConn
->
ownId
;
pHead
->
destId
=
pConn
->
peerId
;
pHead
->
destIp
=
pConn
->
destIp
;
pHead
->
port
=
0
;
pHead
->
uid
=
(
uint32_t
)((
int64_t
)
pConn
+
(
int64_t
)
getpid
());
memcpy
(
pHead
->
user
,
pConn
->
user
,
tListLen
(
pHead
->
user
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录