Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c5ece571
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
c5ece571
编写于
1月 14, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
set refObjId to 0
上级
2e40293b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
18 deletion
+23
-18
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/client/src/clientHb.c
source/client/src/clientHb.c
+21
-17
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
c5ece571
...
...
@@ -197,7 +197,7 @@ void* tDeserializeSClientHbBatchReq(void* buf, SClientHbBatchReq* pReq);
static
FORCE_INLINE
void
tFreeClientHbBatchReq
(
void
*
pReq
)
{
SClientHbBatchReq
*
req
=
(
SClientHbBatchReq
*
)
pReq
;
taosArrayDestroyEx
(
req
->
reqs
,
tFreeClientHbReq
);
//
taosArrayDestroyEx(req->reqs, tFreeClientHbReq);
free
(
pReq
);
}
...
...
source/client/src/clientHb.c
浏览文件 @
c5ece571
...
...
@@ -51,10 +51,6 @@ SClientHbBatchReq* hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
int32_t
connKeyCnt
=
atomic_load_32
(
&
pAppHbMgr
->
connKeyCnt
);
pBatchReq
->
reqs
=
taosArrayInit
(
connKeyCnt
,
sizeof
(
SClientHbReq
));
if
(
pAppHbMgr
->
activeInfo
==
NULL
)
{
return
NULL
;
}
void
*
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
NULL
);
while
(
pIter
!=
NULL
)
{
SClientHbReq
*
pOneReq
=
pIter
;
...
...
@@ -71,7 +67,7 @@ SClientHbBatchReq* hbGatherAllInfo(SAppHbMgr *pAppHbMgr) {
taosHashCopyKey
(
pIter
,
&
connKey
);
getConnInfoFp
(
connKey
,
NULL
);
pIter
=
taosHashIterate
(
pAppHbMgr
->
activeInfo
,
pIter
);
pIter
=
taosHashIterate
(
pAppHbMgr
->
getInfoFuncs
,
pIter
);
}
return
pBatchReq
;
...
...
@@ -87,7 +83,8 @@ static void* hbThreadFunc(void* param) {
int
sz
=
taosArrayGetSize
(
clientHbMgr
.
appHbMgrs
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SAppHbMgr
*
pAppHbMgr
=
taosArrayGet
(
clientHbMgr
.
appHbMgrs
,
i
);
SAppHbMgr
*
pAppHbMgr
=
taosArrayGetP
(
clientHbMgr
.
appHbMgrs
,
i
);
int32_t
connCnt
=
atomic_load_32
(
&
pAppHbMgr
->
connKeyCnt
);
if
(
connCnt
==
0
)
{
continue
;
...
...
@@ -102,20 +99,27 @@ static void* hbThreadFunc(void* param) {
//TODO: error handling
break
;
}
tSerializeSClientHbBatchReq
(
buf
,
pReq
);
SMsgSendInfo
info
;
info
.
fp
=
hbMqAsyncCallBack
;
info
.
msgInfo
.
pData
=
buf
;
info
.
msgInfo
.
len
=
tlen
;
info
.
msgType
=
TDMT_MND_HEARTBEAT
;
info
.
param
=
NULL
;
info
.
requestId
=
generateRequestId
();
info
.
requestObjRefId
=
-
1
;
void
*
bufCopy
=
buf
;
tSerializeSClientHbBatchReq
(
&
bufCopy
,
pReq
);
SMsgSendInfo
*
pInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
pInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tFreeClientHbBatchReq
(
pReq
);
free
(
buf
);
break
;
}
pInfo
->
fp
=
hbMqAsyncCallBack
;
pInfo
->
msgInfo
.
pData
=
buf
;
pInfo
->
msgInfo
.
len
=
tlen
;
pInfo
->
msgType
=
TDMT_MND_HEARTBEAT
;
pInfo
->
param
=
NULL
;
pInfo
->
requestId
=
generateRequestId
();
pInfo
->
requestObjRefId
=
0
;
SAppInstInfo
*
pAppInstInfo
=
pAppHbMgr
->
pAppInstInfo
;
int64_t
transporterId
=
0
;
SEpSet
epSet
=
getEpSet_s
(
&
pAppInstInfo
->
mgmtEp
);
asyncSendMsgToServer
(
pAppInstInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
&
i
nfo
);
asyncSendMsgToServer
(
pAppInstInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pI
nfo
);
tFreeClientHbBatchReq
(
pReq
);
atomic_add_fetch_32
(
&
pAppHbMgr
->
reportCnt
,
1
);
...
...
@@ -182,7 +186,7 @@ void appHbMgrCleanup(SAppHbMgr* pAppHbMgr) {
int
sz
=
taosArrayGetSize
(
clientHbMgr
.
appHbMgrs
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SAppHbMgr
*
pTarget
=
taosArrayGet
(
clientHbMgr
.
appHbMgrs
,
i
);
SAppHbMgr
*
pTarget
=
taosArrayGet
P
(
clientHbMgr
.
appHbMgrs
,
i
);
if
(
pAppHbMgr
==
pTarget
)
{
taosHashCleanup
(
pTarget
->
activeInfo
);
taosHashCleanup
(
pTarget
->
getInfoFuncs
);
...
...
source/client/test/clientTests.cpp
浏览文件 @
c5ece571
...
...
@@ -53,6 +53,7 @@ TEST(testCase, connect_Test) {
if
(
pConn
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
taos_errstr
(
NULL
));
}
sleep
(
3
);
taos_close
(
pConn
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录