Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5d7372c2
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
“beca52b61b3efd061dfff4e65407aa746c955f3d”上不存在“fs/rootfs/los_rootfs.c”
提交
5d7372c2
编写于
1月 01, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update ip str
上级
e7e627d6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
8 deletion
+38
-8
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+38
-8
未找到文件。
src/rpc/src/rpcMain.c
浏览文件 @
5d7372c2
...
@@ -208,6 +208,27 @@ static void rpcUnlockConn(SRpcConn *pConn);
...
@@ -208,6 +208,27 @@ static void rpcUnlockConn(SRpcConn *pConn);
static
void
rpcAddRef
(
SRpcInfo
*
pRpc
);
static
void
rpcAddRef
(
SRpcInfo
*
pRpc
);
static
void
rpcDecRef
(
SRpcInfo
*
pRpc
);
static
void
rpcDecRef
(
SRpcInfo
*
pRpc
);
static
int
ip2str
(
uint32_t
ip
,
char
*
buf
,
int
len
)
{
if
(
buf
==
NULL
||
len
<
16
)
{
return
-
1
;
}
uint8_t
aByte
=
0
;
int
offset
=
0
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
aByte
=
(
ip
&
0x000000FF
);
offset
+=
sprintf
(
&
buf
[
offset
],
"%d"
,
aByte
);
if
(
3
==
i
)
{
buf
[
offset
]
=
'\0'
;
}
else
{
buf
[
offset
++
]
=
'.'
;
}
ip
=
ip
>>
8
;
}
return
0
;
}
static
bool
rpcGenUID
(
uint32_t
*
first
,
uint32_t
*
second
)
{
static
bool
rpcGenUID
(
uint32_t
*
first
,
uint32_t
*
second
)
{
static
uint64_t
hashId
=
0
;
static
uint64_t
hashId
=
0
;
static
uint32_t
tranId
=
0
;
static
uint32_t
tranId
=
0
;
...
@@ -609,6 +630,9 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
...
@@ -609,6 +630,9 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
return
NULL
;
return
NULL
;
}
}
char
buf
[
32
]
=
{
0
};
ip2str
(
peerIp
,
buf
,
sizeof
(
buf
));
pConn
=
rpcAllocateClientConn
(
pRpc
);
pConn
=
rpcAllocateClientConn
(
pRpc
);
if
(
pConn
)
{
if
(
pConn
)
{
...
@@ -622,7 +646,7 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
...
@@ -622,7 +646,7 @@ static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerFqdn, uint16_t peerPort,
void
*
shandle
=
(
connType
&
RPC_CONN_TCP
)
?
pRpc
->
tcphandle
:
pRpc
->
udphandle
;
void
*
shandle
=
(
connType
&
RPC_CONN_TCP
)
?
pRpc
->
tcphandle
:
pRpc
->
udphandle
;
pConn
->
chandle
=
(
*
taosOpenConn
[
connType
])(
shandle
,
pConn
,
pConn
->
peerIp
,
pConn
->
peerPort
);
pConn
->
chandle
=
(
*
taosOpenConn
[
connType
])(
shandle
,
pConn
,
pConn
->
peerIp
,
pConn
->
peerPort
);
if
(
pConn
->
chandle
==
NULL
)
{
if
(
pConn
->
chandle
==
NULL
)
{
tError
(
"failed to connect to:
0x%x:%d"
,
pConn
->
peerIp
,
pConn
->
peerPort
);
tError
(
"failed to connect to:
%s:%d"
,
buf
,
pConn
->
peerPort
);
terrno
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
terrno
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
rpcCloseConn
(
pConn
);
rpcCloseConn
(
pConn
);
...
@@ -1189,14 +1213,17 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
...
@@ -1189,14 +1213,17 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) {
return
pConn
;
return
pConn
;
}
}
char
buf
[
32
]
=
{
0
};
ip2str
(
pRecv
->
ip
,
buf
,
sizeof
(
buf
));
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
%s
:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
taosMsg
[
pHead
->
msgType
],
pRecv
->
ip
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
taosMsg
[
pHead
->
msgType
],
buf
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
}
else
{
}
else
{
tDebug
(
"%s %p %p, %d 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, %d received from
%s
:%hu, parse code:0x%x len:%d sig:0x%08x:0x%08x:%d code:0x%x"
,
pRpc
->
label
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
pHead
->
msgType
,
pRecv
->
ip
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pConn
,
(
void
*
)
pHead
->
ahandle
,
pHead
->
msgType
,
buf
,
pRecv
->
port
,
terrno
,
pRecv
->
msgLen
,
pHead
->
sourceId
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
pHead
->
destId
,
pHead
->
tranId
,
pHead
->
code
);
}
}
int32_t
code
=
terrno
;
int32_t
code
=
terrno
;
...
@@ -1485,13 +1512,16 @@ static bool rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) {
...
@@ -1485,13 +1512,16 @@ static bool rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) {
msgLen
=
rpcAddAuthPart
(
pConn
,
msg
,
msgLen
);
msgLen
=
rpcAddAuthPart
(
pConn
,
msg
,
msgLen
);
char
buf
[
32
]
=
{
0
};
ip2str
(
pConn
->
peerIp
,
buf
,
sizeof
(
buf
));
if
(
rpcIsReq
(
pHead
->
msgType
))
{
if
(
rpcIsReq
(
pHead
->
msgType
))
{
tDebug
(
"%s, %s is sent to %s:%hu, len:%d sig:0x%08x:0x%08x:%d"
,
pConn
->
info
,
taosMsg
[
pHead
->
msgType
],
tDebug
(
"%s, %s is sent to %s:%hu, len:%d sig:0x%08x:0x%08x:%d"
,
pConn
->
info
,
taosMsg
[
pHead
->
msgType
],
pConn
->
peerFqdn
,
pConn
->
peerPort
,
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
pConn
->
peerFqdn
,
pConn
->
peerPort
,
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
}
else
{
}
else
{
if
(
pHead
->
code
==
0
)
pConn
->
secured
=
1
;
// for success response, set link as secured
if
(
pHead
->
code
==
0
)
pConn
->
secured
=
1
;
// for success response, set link as secured
tDebug
(
"%s, %s is sent to
0x%x:%hu, code:0x%x len:%d sig:0x%08x:0x%08x:%d"
,
pConn
->
info
,
taosMsg
[
pHead
->
msgType
]
,
tDebug
(
"%s, %s is sent to
%s:%hu, code:0x%x len:%d sig:0x%08x:0x%08x:%d"
,
pConn
->
info
,
taosMsg
[
pHead
->
msgType
],
buf
,
pConn
->
peer
Ip
,
pConn
->
peer
Port
,
htonl
(
pHead
->
code
),
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
pConn
->
peerPort
,
htonl
(
pHead
->
code
),
msgLen
,
pHead
->
sourceId
,
pHead
->
destId
,
pHead
->
tranId
);
}
}
// tTrace("connection type is: %d", pConn->connType);
// tTrace("connection type is: %d", pConn->connType);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录