Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cc5ae34d
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看板
提交
cc5ae34d
编写于
2月 16, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix conn persist bug
上级
8bb83943
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
15 deletion
+11
-15
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
+9
-14
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
cc5ae34d
...
...
@@ -140,6 +140,7 @@ typedef struct {
SRpcMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
int
hThrdIdx
;
char
*
ip
;
uint32_t
port
;
// SEpSet* pSet; // for synchronous API
...
...
source/libs/transport/src/transCli.c
浏览文件 @
cc5ae34d
...
...
@@ -17,7 +17,7 @@
#include "transComm.h"
#define CONN_HOST_THREAD_INDEX(conn ? ((SCliConn*)conn)->hThrdIdx : -1)
#define CONN_HOST_THREAD_INDEX(conn
) (conn
? ((SCliConn*)conn)->hThrdIdx : -1)
#define CONN_PERSIST_TIME(para) (para * 1000 * 10)
typedef
struct
SCliConn
{
...
...
@@ -29,8 +29,8 @@ typedef struct SCliConn {
void
*
data
;
queue
conn
;
uint64_t
expireTime
;
int8_t
ctnRdCnt
;
//
timers already notify to clie
nt
int
h
ostThreadInde
x
;
int8_t
ctnRdCnt
;
//
continue read cou
nt
int
h
ThrdId
x
;
SRpcPush
*
push
;
int
persist
;
//
...
...
@@ -482,12 +482,12 @@ static void clientHandleReq(SCliMsg* pMsg, SCliThrdObj* pThrd) {
if
(
pMsg
->
msg
.
handle
==
NULL
)
{
conn
=
getConnFromPool
(
pThrd
->
pool
,
pCtx
->
ip
,
pCtx
->
port
);
if
(
conn
!=
NULL
)
{
tTrace
(
"client conn %
d
get from conn pool"
,
conn
);
tTrace
(
"client conn %
p
get from conn pool"
,
conn
);
}
}
else
{
conn
=
(
SCliConn
*
)(
pMsg
->
msg
.
handle
);
if
(
conn
!=
NULL
)
{
tTrace
(
"client conn %
d
reused"
,
conn
);
tTrace
(
"client conn %
p
reused"
,
conn
);
}
}
...
...
@@ -503,7 +503,7 @@ static void clientHandleReq(SCliMsg* pMsg, SCliThrdObj* pThrd) {
clientWrite
(
conn
);
}
else
{
SCliConn
*
conn
=
calloc
(
1
,
sizeof
(
SCliConn
));
conn
=
calloc
(
1
,
sizeof
(
SCliConn
));
conn
->
ref
++
;
// read/write stream handle
conn
->
stream
=
(
uv_stream_t
*
)
malloc
(
sizeof
(
uv_tcp_t
));
...
...
@@ -652,15 +652,9 @@ static void clientSendQuit(SCliThrdObj* thrd) {
SCliMsg
*
msg
=
calloc
(
1
,
sizeof
(
SCliMsg
));
msg
->
ctx
=
NULL
;
//
// pthread_mutex_lock(&thrd->msgMtx);
// QUEUE_PUSH(&thrd->msg, &msg->q);
// pthread_mutex_unlock(&thrd->msgMtx);
transSendAsync
(
thrd
->
asyncPool
,
&
msg
->
q
);
// uv_async_send(thrd->cliAsync);
}
void
taosCloseClient
(
void
*
arg
)
{
// impl later
SClientObj
*
cli
=
arg
;
for
(
int
i
=
0
;
i
<
cli
->
numOfThreads
;
i
++
)
{
clientSendQuit
(
cli
->
pThreadObj
[
i
]);
...
...
@@ -683,7 +677,7 @@ void rpcSendRequest(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t*
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
int
index
=
CONN_HOST_THREAD_INDEX
(
pMsg
.
handle
);
int
index
=
CONN_HOST_THREAD_INDEX
(
pMsg
->
handle
);
if
(
index
==
-
1
)
{
index
=
clientRBChoseIdx
(
pRpc
);
}
...
...
@@ -717,7 +711,7 @@ void rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pReq, SRpcMsg* pRsp) {
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
int
index
=
CONN_HOST_THREAD_INDEX
(
p
Msg
.
handle
);
int
index
=
CONN_HOST_THREAD_INDEX
(
p
Req
->
handle
);
if
(
index
==
-
1
)
{
index
=
clientRBChoseIdx
(
pRpc
);
}
...
...
@@ -728,6 +722,7 @@ void rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pReq, SRpcMsg* pRsp) {
pCtx
->
msgType
=
pReq
->
msgType
;
pCtx
->
ip
=
strdup
(
ip
);
pCtx
->
port
=
port
;
pCtx
->
hThrdIdx
=
index
;
pCtx
->
pSem
=
calloc
(
1
,
sizeof
(
tsem_t
));
pCtx
->
pRsp
=
pRsp
;
tsem_init
(
pCtx
->
pSem
,
0
,
0
);
...
...
source/libs/transport/test/rclient.c
浏览文件 @
cc5ae34d
...
...
@@ -96,7 +96,7 @@ static void *sendRequest(void *param) {
int
main
(
int
argc
,
char
*
argv
[])
{
SRpcInit
rpcInit
;
SEpSet
epSet
;
SEpSet
epSet
=
{
0
}
;
int
msgSize
=
128
;
int
numOfReqs
=
0
;
int
appThreads
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录