Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57436e5a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
57436e5a
编写于
7月 21, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avoid mem leak
上级
dac39371
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
5 deletion
+20
-5
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+16
-4
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+3
-1
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
57436e5a
...
@@ -226,6 +226,7 @@ typedef struct {
...
@@ -226,6 +226,7 @@ typedef struct {
int
index
;
int
index
;
int
nAsync
;
int
nAsync
;
uv_async_t
*
asyncs
;
uv_async_t
*
asyncs
;
int8_t
stop
;
}
SAsyncPool
;
}
SAsyncPool
;
SAsyncPool
*
transCreateAsyncPool
(
uv_loop_t
*
loop
,
int
sz
,
void
*
arg
,
AsyncCB
cb
);
SAsyncPool
*
transCreateAsyncPool
(
uv_loop_t
*
loop
,
int
sz
,
void
*
arg
,
AsyncCB
cb
);
...
...
source/libs/transport/src/transCli.c
浏览文件 @
57436e5a
...
@@ -1020,6 +1020,7 @@ void cliSendQuit(SCliThrd* thrd) {
...
@@ -1020,6 +1020,7 @@ void cliSendQuit(SCliThrd* thrd) {
SCliMsg
*
msg
=
taosMemoryCalloc
(
1
,
sizeof
(
SCliMsg
));
SCliMsg
*
msg
=
taosMemoryCalloc
(
1
,
sizeof
(
SCliMsg
));
msg
->
type
=
Quit
;
msg
->
type
=
Quit
;
transAsyncSend
(
thrd
->
asyncPool
,
&
msg
->
q
);
transAsyncSend
(
thrd
->
asyncPool
,
&
msg
->
q
);
atomic_store_8
(
&
thrd
->
asyncPool
->
stop
,
1
);
}
}
void
cliWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
)
{
void
cliWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
)
{
if
(
!
uv_is_closing
(
handle
))
{
if
(
!
uv_is_closing
(
handle
))
{
...
@@ -1238,7 +1239,9 @@ int transReleaseCliHandle(void* handle) {
...
@@ -1238,7 +1239,9 @@ int transReleaseCliHandle(void* handle) {
cmsg
->
msg
=
tmsg
;
cmsg
->
msg
=
tmsg
;
cmsg
->
type
=
Release
;
cmsg
->
type
=
Release
;
transAsyncSend
(
pThrd
->
asyncPool
,
&
cmsg
->
q
);
if
(
0
!=
transAsyncSend
(
pThrd
->
asyncPool
,
&
cmsg
->
q
))
{
return
-
1
;
}
return
0
;
return
0
;
}
}
...
@@ -1279,7 +1282,10 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
...
@@ -1279,7 +1282,10 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran
STraceId
*
trace
=
&
pReq
->
info
.
traceId
;
STraceId
*
trace
=
&
pReq
->
info
.
traceId
;
tGDebug
(
"%s send request at thread:%08"
PRId64
", dst:%s:%d, app:%p"
,
transLabel
(
pTransInst
),
pThrd
->
pid
,
tGDebug
(
"%s send request at thread:%08"
PRId64
", dst:%s:%d, app:%p"
,
transLabel
(
pTransInst
),
pThrd
->
pid
,
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
ASSERT
(
transAsyncSend
(
pThrd
->
asyncPool
,
&
(
cliMsg
->
q
))
==
0
);
if
(
0
!=
transAsyncSend
(
pThrd
->
asyncPool
,
&
(
cliMsg
->
q
)))
{
destroyCmsg
(
cliMsg
);
return
-
1
;
}
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
return
0
;
return
0
;
}
}
...
@@ -1323,7 +1329,10 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
...
@@ -1323,7 +1329,10 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs
tGDebug
(
"%s send request at thread:%08"
PRId64
", dst:%s:%d, app:%p"
,
transLabel
(
pTransInst
),
pThrd
->
pid
,
tGDebug
(
"%s send request at thread:%08"
PRId64
", dst:%s:%d, app:%p"
,
transLabel
(
pTransInst
),
pThrd
->
pid
,
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
EPSET_GET_INUSE_IP
(
&
pCtx
->
epSet
),
EPSET_GET_INUSE_PORT
(
&
pCtx
->
epSet
),
pReq
->
info
.
ahandle
);
transAsyncSend
(
pThrd
->
asyncPool
,
&
(
cliMsg
->
q
));
if
(
0
!=
transAsyncSend
(
pThrd
->
asyncPool
,
&
cliMsg
->
q
))
{
destroyCmsg
(
cliMsg
);
return
-
1
;
}
tsem_wait
(
sem
);
tsem_wait
(
sem
);
tsem_destroy
(
sem
);
tsem_destroy
(
sem
);
taosMemoryFree
(
sem
);
taosMemoryFree
(
sem
);
...
@@ -1358,7 +1367,10 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
...
@@ -1358,7 +1367,10 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
SCliThrd
*
thrd
=
((
SCliObj
*
)
pTransInst
->
tcphandle
)
->
pThreadObj
[
i
];
SCliThrd
*
thrd
=
((
SCliObj
*
)
pTransInst
->
tcphandle
)
->
pThreadObj
[
i
];
tDebug
(
"%s update epset at thread:%08"
PRId64
,
pTransInst
->
label
,
thrd
->
pid
);
tDebug
(
"%s update epset at thread:%08"
PRId64
,
pTransInst
->
label
,
thrd
->
pid
);
transAsyncSend
(
thrd
->
asyncPool
,
&
(
cliMsg
->
q
));
if
(
transAsyncSend
(
thrd
->
asyncPool
,
&
(
cliMsg
->
q
))
!=
0
)
{
destroyCmsg
(
cliMsg
);
return
-
1
;
}
}
}
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
transReleaseExHandle
(
transGetInstMgt
(),
(
int64_t
)
shandle
);
return
0
;
return
0
;
...
...
source/libs/transport/src/transComm.c
浏览文件 @
57436e5a
...
@@ -177,7 +177,6 @@ int transSetConnOption(uv_tcp_t* stream) {
...
@@ -177,7 +177,6 @@ int transSetConnOption(uv_tcp_t* stream) {
SAsyncPool
*
transCreateAsyncPool
(
uv_loop_t
*
loop
,
int
sz
,
void
*
arg
,
AsyncCB
cb
)
{
SAsyncPool
*
transCreateAsyncPool
(
uv_loop_t
*
loop
,
int
sz
,
void
*
arg
,
AsyncCB
cb
)
{
SAsyncPool
*
pool
=
taosMemoryCalloc
(
1
,
sizeof
(
SAsyncPool
));
SAsyncPool
*
pool
=
taosMemoryCalloc
(
1
,
sizeof
(
SAsyncPool
));
pool
->
index
=
0
;
pool
->
nAsync
=
sz
;
pool
->
nAsync
=
sz
;
pool
->
asyncs
=
taosMemoryCalloc
(
1
,
sizeof
(
uv_async_t
)
*
pool
->
nAsync
);
pool
->
asyncs
=
taosMemoryCalloc
(
1
,
sizeof
(
uv_async_t
)
*
pool
->
nAsync
);
...
@@ -207,6 +206,9 @@ void transDestroyAsyncPool(SAsyncPool* pool) {
...
@@ -207,6 +206,9 @@ void transDestroyAsyncPool(SAsyncPool* pool) {
taosMemoryFree
(
pool
);
taosMemoryFree
(
pool
);
}
}
int
transAsyncSend
(
SAsyncPool
*
pool
,
queue
*
q
)
{
int
transAsyncSend
(
SAsyncPool
*
pool
,
queue
*
q
)
{
if
(
atomic_load_8
(
&
pool
->
stop
)
==
1
)
{
return
-
1
;
}
int
idx
=
pool
->
index
;
int
idx
=
pool
->
index
;
idx
=
idx
%
pool
->
nAsync
;
idx
=
idx
%
pool
->
nAsync
;
// no need mutex here
// no need mutex here
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录