Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
baf580ee
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
baf580ee
编写于
10月 02, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1632 revert
上级
4c082502
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
11 deletion
+19
-11
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+19
-11
未找到文件。
src/rpc/src/rpcMain.c
浏览文件 @
baf580ee
...
@@ -195,7 +195,7 @@ static void rpcSendMsgToPeer(SRpcConn *pConn, void *data, int dataLen);
...
@@ -195,7 +195,7 @@ static void rpcSendMsgToPeer(SRpcConn *pConn, void *data, int dataLen);
static
void
rpcSendReqHead
(
SRpcConn
*
pConn
);
static
void
rpcSendReqHead
(
SRpcConn
*
pConn
);
static
void
*
rpcProcessMsgFromPeer
(
SRecvInfo
*
pRecv
);
static
void
*
rpcProcessMsgFromPeer
(
SRecvInfo
*
pRecv
);
static
void
rpcProcessIncomingMsg
(
SRpcConn
*
pConn
,
SRpcHead
*
pHead
);
static
void
rpcProcessIncomingMsg
(
SRpcConn
*
pConn
,
SRpcHead
*
pHead
,
SRpcReqContext
*
pContext
);
static
void
rpcProcessConnError
(
void
*
param
,
void
*
id
);
static
void
rpcProcessConnError
(
void
*
param
,
void
*
id
);
static
void
rpcProcessRetryTimer
(
void
*
,
void
*
);
static
void
rpcProcessRetryTimer
(
void
*
,
void
*
);
static
void
rpcProcessIdleTimer
(
void
*
param
,
void
*
tmrId
);
static
void
rpcProcessIdleTimer
(
void
*
param
,
void
*
tmrId
);
...
@@ -885,13 +885,14 @@ static int rpcProcessRspHead(SRpcConn *pConn, SRpcHead *pHead) {
...
@@ -885,13 +885,14 @@ static int rpcProcessRspHead(SRpcConn *pConn, SRpcHead *pHead) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
SRpcConn
*
rpcProcessMsgHead
(
SRpcInfo
*
pRpc
,
SRecvInfo
*
pRecv
)
{
static
SRpcConn
*
rpcProcessMsgHead
(
SRpcInfo
*
pRpc
,
SRecvInfo
*
pRecv
,
SRpcReqContext
**
ppContext
)
{
int32_t
sid
;
int32_t
sid
;
SRpcConn
*
pConn
=
NULL
;
SRpcConn
*
pConn
=
NULL
;
SRpcHead
*
pHead
=
(
SRpcHead
*
)
pRecv
->
msg
;
SRpcHead
*
pHead
=
(
SRpcHead
*
)
pRecv
->
msg
;
sid
=
htonl
(
pHead
->
destId
);
sid
=
htonl
(
pHead
->
destId
);
*
ppContext
=
NULL
;
if
(
pHead
->
msgType
>=
TSDB_MSG_TYPE_MAX
||
pHead
->
msgType
<=
0
)
{
if
(
pHead
->
msgType
>=
TSDB_MSG_TYPE_MAX
||
pHead
->
msgType
<=
0
)
{
tDebug
(
"%s sid:%d, invalid message type:%d"
,
pRpc
->
label
,
sid
,
pHead
->
msgType
);
tDebug
(
"%s sid:%d, invalid message type:%d"
,
pRpc
->
label
,
sid
,
pHead
->
msgType
);
...
@@ -945,6 +946,17 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) {
...
@@ -945,6 +946,17 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) {
pConn
->
pIdleTimer
=
taosTmrStart
(
rpcProcessIdleTimer
,
tsRpcTimer
*
2
,
pConn
,
pRpc
->
tmrCtrl
);
pConn
->
pIdleTimer
=
taosTmrStart
(
rpcProcessIdleTimer
,
tsRpcTimer
*
2
,
pConn
,
pRpc
->
tmrCtrl
);
}
else
{
}
else
{
terrno
=
rpcProcessRspHead
(
pConn
,
pHead
);
terrno
=
rpcProcessRspHead
(
pConn
,
pHead
);
if
(
terrno
==
0
)
{
SRpcReqContext
*
pContext
=
pConn
->
pContext
;
*
ppContext
=
pContext
;
pConn
->
pContext
=
NULL
;
pConn
->
pReqMsg
=
NULL
;
// for UDP, port may be changed by server, the port in epSet shall be used for cache
if
(
pHead
->
code
!=
TSDB_CODE_RPC_TOO_SLOW
)
{
rpcAddConnIntoCache
(
pRpc
->
pCache
,
pConn
,
pConn
->
peerFqdn
,
pContext
->
epSet
.
port
[
pContext
->
epSet
.
inUse
],
pConn
->
connType
);
}
}
}
}
}
}
...
@@ -1009,7 +1021,8 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
...
@@ -1009,7 +1021,8 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
}
}
terrno
=
0
;
terrno
=
0
;
pConn
=
rpcProcessMsgHead
(
pRpc
,
pRecv
);
SRpcReqContext
*
pContext
;
pConn
=
rpcProcessMsgHead
(
pRpc
,
pRecv
,
&
pContext
);
if
(
pHead
->
msgType
>=
1
&&
pHead
->
msgType
<
TSDB_MSG_TYPE_MAX
)
{
if
(
pHead
->
msgType
>=
1
&&
pHead
->
msgType
<
TSDB_MSG_TYPE_MAX
)
{
tDebug
(
"%s %p %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
tDebug
(
"%s %p %p, %s received from 0x%x:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
...
@@ -1029,7 +1042,7 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
...
@@ -1029,7 +1042,7 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
tDebug
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
taosMsg
[
pHead
->
msgType
+
1
],
code
);
tDebug
(
"%s %p %p, %s is sent with error code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
taosMsg
[
pHead
->
msgType
+
1
],
code
);
}
}
}
else
{
// msg is passed to app only parsing is ok
}
else
{
// msg is passed to app only parsing is ok
rpcProcessIncomingMsg
(
pConn
,
pHead
);
rpcProcessIncomingMsg
(
pConn
,
pHead
,
pContext
);
}
}
}
}
...
@@ -1060,7 +1073,7 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
...
@@ -1060,7 +1073,7 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
rpcFreeCont
(
pContext
->
pCont
);
rpcFreeCont
(
pContext
->
pCont
);
}
}
static
void
rpcProcessIncomingMsg
(
SRpcConn
*
pConn
,
SRpcHead
*
pHead
)
{
static
void
rpcProcessIncomingMsg
(
SRpcConn
*
pConn
,
SRpcHead
*
pHead
,
SRpcReqContext
*
pContext
)
{
SRpcInfo
*
pRpc
=
pConn
->
pRpc
;
SRpcInfo
*
pRpc
=
pConn
->
pRpc
;
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
...
@@ -1089,15 +1102,10 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
...
@@ -1089,15 +1102,10 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
}
}
}
else
{
}
else
{
// it's a response
// it's a response
SRpcReqContext
*
pContext
=
pConn
->
pContext
;
rpcMsg
.
handle
=
pContext
;
rpcMsg
.
handle
=
pContext
;
pConn
->
pContext
=
NULL
;
pConn
->
pReqMsg
=
NULL
;
// for UDP, port may be changed by server, the port in epSet shall be used for cache
// for UDP, port may be changed by server, the port in epSet shall be used for cache
if
(
pHead
->
code
!=
TSDB_CODE_RPC_TOO_SLOW
)
{
if
(
pHead
->
code
==
TSDB_CODE_RPC_TOO_SLOW
)
{
rpcAddConnIntoCache
(
pRpc
->
pCache
,
pConn
,
pConn
->
peerFqdn
,
pContext
->
epSet
.
port
[
pContext
->
epSet
.
inUse
],
pConn
->
connType
);
}
else
{
rpcCloseConn
(
pConn
);
rpcCloseConn
(
pConn
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录