Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
219c8dbf
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
219c8dbf
编写于
4月 21, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(rpc):add auth
上级
7e902a3e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
36 addition
and
16 deletion
+36
-16
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+12
-8
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+7
-6
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+16
-2
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
219c8dbf
...
...
@@ -54,12 +54,13 @@ typedef struct {
uint16_t
clientPort
;
SRpcMsg
rpcMsg
;
int32_t
rspLen
;
void
*
pRsp
;
void
*
pNode
;
void
*
pRsp
;
void
*
pNode
;
}
SNodeMsg
;
typedef
void
(
*
RpcCfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
typedef
int
(
*
RpcAfp
)(
void
*
parent
,
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
typedef
int
(
*
RpcRfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
typedef
struct
SRpcInit
{
uint16_t
localPort
;
// local port
...
...
@@ -80,7 +81,10 @@ typedef struct SRpcInit {
RpcCfp
cfp
;
// call back to retrieve the client auth info, for server app only
RpcAfp
afp
;;
RpcAfp
afp
;
// user defined retry func
RpcRfp
rfp
;
void
*
parent
;
}
SRpcInit
;
...
...
@@ -93,7 +97,7 @@ typedef struct {
typedef
struct
{
int32_t
msgType
;
void
*
val
;
void
*
val
;
int32_t
(
*
clone
)(
void
*
src
,
void
**
dst
);
void
(
*
freeFunc
)(
const
void
*
arg
);
}
SRpcBrokenlinkVal
;
...
...
source/libs/transport/inc/transportInt.h
浏览文件 @
219c8dbf
...
...
@@ -63,6 +63,7 @@ typedef struct {
void
(
*
cfp
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
int
(
*
afp
)(
void
*
parent
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int
(
*
retry
)(
void
*
parent
,
SRpcMsg
*
,
SEpSet
*
);
int32_t
refCount
;
void
*
parent
;
...
...
source/libs/transport/src/trans.c
浏览文件 @
219c8dbf
...
...
@@ -39,6 +39,7 @@ void* rpcOpen(const SRpcInit* pInit) {
// register callback handle
pRpc
->
cfp
=
pInit
->
cfp
;
pRpc
->
afp
=
pInit
->
afp
;
pRpc
->
retry
=
pInit
->
rfp
;
if
(
pInit
->
connType
==
TAOS_CONN_SERVER
)
{
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
219c8dbf
...
...
@@ -97,6 +97,8 @@ static void cliSendCb(uv_write_t* req, int status);
static
void
cliConnCb
(
uv_connect_t
*
req
,
int
status
);
static
void
cliAsyncCb
(
uv_async_t
*
handle
);
static
void
cliAppCb
(
SCliConn
*
pConn
,
STransMsg
*
pMsg
);
static
SCliConn
*
cliCreateConn
(
SCliThrdObj
*
thrd
);
static
void
cliDestroyConn
(
SCliConn
*
pConn
,
bool
clear
/*clear tcp handle or not*/
);
static
void
cliDestroy
(
uv_handle_t
*
handle
);
...
...
@@ -311,7 +313,8 @@ void cliHandleResp(SCliConn* conn) {
if
(
pCtx
==
NULL
||
pCtx
->
pSem
==
NULL
)
{
tTrace
(
"%s cli conn %p handle resp"
,
pTransInst
->
label
,
conn
);
(
pTransInst
->
cfp
)(
pTransInst
->
parent
,
&
transMsg
,
NULL
);
cliAppCb
(
conn
,
&
transMsg
);
//(pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
}
else
{
tTrace
(
"%s cli conn(sync) %p handle resp"
,
pTransInst
->
label
,
conn
);
memcpy
((
char
*
)
pCtx
->
pRsp
,
(
char
*
)
&
transMsg
,
sizeof
(
transMsg
));
...
...
@@ -377,7 +380,8 @@ void cliHandleExcept(SCliConn* pConn) {
once
=
true
;
continue
;
}
(
pTransInst
->
cfp
)(
pTransInst
->
parent
,
&
transMsg
,
NULL
);
cliAppCb
(
pConn
,
&
transMsg
);
//(pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
}
else
{
tTrace
(
"%s cli conn(sync) %p handle except"
,
pTransInst
->
label
,
pConn
);
memcpy
((
char
*
)(
pCtx
->
pRsp
),
(
char
*
)(
&
transMsg
),
sizeof
(
transMsg
));
...
...
@@ -877,6 +881,16 @@ int cliRBChoseIdx(STrans* pTransInst) {
}
return
index
%
pTransInst
->
numOfThreads
;
}
void
cliAppCb
(
SCliConn
*
pConn
,
STransMsg
*
transMsg
)
{
SCliThrdObj
*
pThrd
=
pConn
->
hostThrd
;
STrans
*
pTransInst
=
pThrd
->
pTransInst
;
if
(
transMsg
->
code
==
TSDB_CODE_RPC_REDIRECT
&&
pTransInst
->
retry
!=
NULL
)
{
// impl retry
}
else
{
(
*
pTransInst
->
cfp
)(
pTransInst
->
parent
,
transMsg
,
NULL
);
}
}
void
transCloseClient
(
void
*
arg
)
{
SCliObj
*
cli
=
arg
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录