Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
46d4bf90
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
46d4bf90
编写于
7月 21, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor rpc code
上级
67d99c9c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
8 deletion
+33
-8
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+3
-3
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+11
-3
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+19
-2
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
46d4bf90
...
...
@@ -393,9 +393,9 @@ typedef struct SDelayQueue {
uv_loop_t
*
loop
;
}
SDelayQueue
;
int
transDQCreate
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
);
void
transDQDestroy
(
SDelayQueue
*
queue
,
void
(
*
freeFunc
)(
void
*
arg
));
int
transDQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
);
int
transDQCreate
(
uv_loop_t
*
loop
,
SDelayQueue
**
queue
);
void
transDQDestroy
(
SDelayQueue
*
queue
,
void
(
*
freeFunc
)(
void
*
arg
));
SDelayTask
*
transDQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
);
bool
transEpSetIsEqual
(
SEpSet
*
a
,
SEpSet
*
b
);
/*
...
...
source/libs/transport/src/transCli.c
浏览文件 @
46d4bf90
...
...
@@ -1054,6 +1054,12 @@ static void doDelayTask(void* param) {
cliHandleReq
(
pMsg
,
pThrd
);
}
static
void
doCloseIdleConn
(
void
*
param
)
{
STaskArg
*
arg
=
param
;
SCliConn
*
conn
=
arg
->
param1
;
SCliThrd
*
pThrd
=
arg
->
param2
;
}
static
void
cliSchedMsgToNextNode
(
SCliMsg
*
pMsg
,
SCliThrd
*
pThrd
)
{
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
...
...
@@ -1075,7 +1081,7 @@ void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) {
}
}
bool
cliTry
To
ExtractEpSet
(
STransMsg
*
pResp
,
SEpSet
*
dst
)
{
bool
cliTryExtractEpSet
(
STransMsg
*
pResp
,
SEpSet
*
dst
)
{
if
((
pResp
==
NULL
||
pResp
->
info
.
hasEpSet
==
0
))
{
return
false
;
}
...
...
@@ -1116,7 +1122,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
*/
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
int32_t
code
=
pResp
->
code
;
bool
retry
=
(
pTransInst
->
retry
!=
NULL
&&
pTransInst
->
retry
(
code
,
pResp
->
msgType
-
1
))
?
true
:
false
;
bool
retry
=
(
pTransInst
->
retry
!=
NULL
&&
pTransInst
->
retry
(
code
,
pResp
->
msgType
-
1
))
?
true
:
false
;
if
(
retry
)
{
pMsg
->
sent
=
0
;
pCtx
->
retryCnt
+=
1
;
...
...
@@ -1125,6 +1132,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
if
(
pCtx
->
retryCnt
<
pCtx
->
retryLimit
)
{
transUnrefCliHandle
(
pConn
);
EPSET_FORWARD_INUSE
(
&
pCtx
->
epSet
);
transFreeMsg
(
pResp
->
pCont
);
cliSchedMsgToNextNode
(
pMsg
,
pThrd
);
return
-
1
;
}
...
...
@@ -1148,7 +1156,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
STraceId
*
trace
=
&
pResp
->
info
.
traceId
;
bool
hasEpSet
=
cliTry
To
ExtractEpSet
(
pResp
,
&
pCtx
->
epSet
);
bool
hasEpSet
=
cliTryExtractEpSet
(
pResp
,
&
pCtx
->
epSet
);
if
(
hasEpSet
)
{
char
tbuf
[
256
]
=
{
0
};
EPSET_DEBUG_STR
(
&
pCtx
->
epSet
,
tbuf
);
...
...
source/libs/transport/src/transComm.c
浏览文件 @
46d4bf90
...
...
@@ -488,8 +488,25 @@ void transDQDestroy(SDelayQueue* queue, void (*freeFunc)(void* arg)) {
heapDestroy
(
queue
->
heap
);
taosMemoryFree
(
queue
);
}
void
transDQCancel
(
SDelayQueue
*
queue
,
SDelayTask
*
task
)
{
uv_timer_stop
(
queue
->
timer
);
int
transDQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
)
{
if
(
heapSize
(
queue
->
heap
)
<=
0
)
return
;
heapRemove
(
queue
->
heap
,
&
task
->
node
);
if
(
heapSize
(
queue
->
heap
)
!=
0
)
{
HeapNode
*
minNode
=
heapMin
(
queue
->
heap
);
if
(
minNode
!=
NULL
)
return
;
uint64_t
now
=
taosGetTimestampMs
();
SDelayTask
*
task
=
container_of
(
minNode
,
SDelayTask
,
node
);
uint64_t
timeout
=
now
>
task
->
execTime
?
now
-
task
->
execTime
:
0
;
uv_timer_start
(
queue
->
timer
,
transDQTimeout
,
timeout
,
0
);
}
}
SDelayTask
*
transDQSched
(
SDelayQueue
*
queue
,
void
(
*
func
)(
void
*
arg
),
void
*
arg
,
uint64_t
timeoutMs
)
{
uint64_t
now
=
taosGetTimestampMs
();
SDelayTask
*
task
=
taosMemoryCalloc
(
1
,
sizeof
(
SDelayTask
));
task
->
func
=
func
;
...
...
@@ -507,7 +524,7 @@ int transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_
tTrace
(
"timer %p put task into delay queue, timeoutMs:%"
PRIu64
,
queue
->
timer
,
timeoutMs
);
heapInsert
(
queue
->
heap
,
&
task
->
node
);
uv_timer_start
(
queue
->
timer
,
transDQTimeout
,
timeoutMs
,
0
);
return
0
;
return
task
;
}
void
transPrintEpSet
(
SEpSet
*
pEpSet
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录