Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b34a5bdf
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看板
提交
b34a5bdf
编写于
1月 24, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more trace info and handle conn except
上级
07cb902a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
10 deletion
+18
-10
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+11
-8
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+6
-1
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
未找到文件。
source/libs/transport/src/transCli.c
浏览文件 @
b34a5bdf
...
...
@@ -267,20 +267,20 @@ static void clientReadCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf
if
(
nread
>
0
)
{
pBuf
->
len
+=
nread
;
if
(
clientReadComplete
(
pBuf
))
{
tDebug
(
"conn
read complete"
);
tDebug
(
"conn
%p read complete"
,
conn
);
clientHandleResp
(
conn
);
}
else
{
tDebug
(
"conn
read half packet, continue to read"
);
tDebug
(
"conn
%p read partial packet, continue to read"
,
conn
);
}
return
;
}
assert
(
nread
<=
0
);
if
(
nread
==
0
)
{
tError
(
"conn
closed"
);
tError
(
"conn
%p closed"
,
conn
);
return
;
}
if
(
nread
<
0
)
{
tError
(
"conn
read error: %s"
,
uv_err_name
(
nread
));
tError
(
"conn
%p read error: %s"
,
conn
,
uv_err_name
(
nread
));
clientHandleExcept
(
conn
);
}
// tDebug("Read error %s\n", uv_err_name(nread));
...
...
@@ -307,9 +307,9 @@ static void clientWriteCb(uv_write_t* req, int status) {
SCliConn
*
pConn
=
req
->
data
;
if
(
status
==
0
)
{
tDebug
(
"conn
data already was written out"
);
tDebug
(
"conn
%p data already was written out"
,
pConn
);
}
else
{
tError
(
"
failed to write: %s"
,
uv_err_name
(
status
));
tError
(
"
conn %p failed to write: %s"
,
pConn
,
uv_err_name
(
status
));
clientHandleExcept
(
pConn
);
return
;
}
...
...
@@ -334,7 +334,7 @@ static void clientWrite(SCliConn* pConn) {
pHead
->
msgLen
=
(
int32_t
)
htonl
((
uint32_t
)
msgLen
);
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
tDebug
(
"
data write out, msgType : %d, len: %d"
,
pHead
->
msgType
,
msgLen
);
tDebug
(
"
conn %p data write out, msgType : %d, len: %d"
,
pConn
,
pHead
->
msgType
,
msgLen
);
uv_write
(
pConn
->
writeReq
,
(
uv_stream_t
*
)
pConn
->
stream
,
&
wb
,
1
,
clientWriteCb
);
}
static
void
clientConnCb
(
uv_connect_t
*
req
,
int
status
)
{
...
...
@@ -342,9 +342,11 @@ static void clientConnCb(uv_connect_t* req, int status) {
SCliConn
*
pConn
=
req
->
data
;
if
(
status
!=
0
)
{
// tError("failed to connect server(%s, %d), errmsg: %s", pCtx->ip, pCtx->port, uv_strerror(status));
tError
(
"
failed to connect server, errmsg: %s"
,
uv_strerror
(
status
));
tError
(
"
conn %p failed to connect server: %s"
,
pConn
,
uv_strerror
(
status
));
clientHandleExcept
(
pConn
);
return
;
}
tDebug
(
"conn %p create"
,
pConn
);
assert
(
pConn
->
stream
==
req
->
handle
);
clientWrite
(
pConn
);
...
...
@@ -360,6 +362,7 @@ static void clientHandleReq(SCliMsg* pMsg, SCliThrdObj* pThrd) {
SCliConn
*
conn
=
getConnFromPool
(
pThrd
->
pool
,
pCtx
->
ip
,
pCtx
->
port
);
if
(
conn
!=
NULL
)
{
// impl later
tDebug
(
"conn %p get from conn pool"
,
conn
);
conn
->
data
=
pMsg
;
conn
->
writeReq
->
data
=
conn
;
...
...
source/libs/transport/src/transSrv.c
浏览文件 @
b34a5bdf
...
...
@@ -27,7 +27,6 @@ typedef struct SConn {
int
ref
;
int
persist
;
// persist connection or not
SConnBuffer
connBuf
;
// read buf,
int
count
;
int
inType
;
void
*
pTransInst
;
// rpc init
void
*
ahandle
;
//
...
...
@@ -272,6 +271,7 @@ static void uvHandleReq(SConn* pConn) {
rpcMsg
.
ahandle
=
NULL
;
rpcMsg
.
handle
=
pConn
;
pConn
->
ref
++
;
(
*
(
pRpc
->
cfp
))(
pRpc
->
parent
,
&
rpcMsg
,
NULL
);
// uv_timer_start(pConn->pTimer, uvHandleActivityTimeout, pRpc->idleTime * 10000, 0);
// auth
...
...
@@ -432,6 +432,7 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
assert
(
pending
==
UV_TCP
);
SConn
*
pConn
=
createConn
();
pConn
->
pTransInst
=
pThrd
->
pTransInst
;
/* init conn timer*/
pConn
->
pTimer
=
malloc
(
sizeof
(
uv_timer_t
));
...
...
@@ -520,6 +521,7 @@ void* workerThread(void* arg) {
static
SConn
*
createConn
()
{
SConn
*
pConn
=
(
SConn
*
)
calloc
(
1
,
sizeof
(
SConn
));
++
pConn
->
ref
;
return
pConn
;
}
...
...
@@ -527,6 +529,9 @@ static void destroyConn(SConn* conn, bool clear) {
if
(
conn
==
NULL
)
{
return
;
}
if
(
--
conn
->
ref
==
0
)
{
return
;
}
if
(
clear
)
{
uv_close
((
uv_handle_t
*
)
conn
->
pTcp
,
NULL
);
}
...
...
source/libs/transport/test/rclient.c
浏览文件 @
b34a5bdf
...
...
@@ -63,7 +63,7 @@ static void *sendRequest(void *param) {
if
(
pInfo
->
num
%
20000
==
0
)
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
// tsem_wait(&pInfo->rspSem);
tsem_wait
(
&
pInfo
->
rspSem
);
tDebug
(
"recv response"
);
tDebug
(
"recv response
succefully
"
);
// usleep(100000000);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录