Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dc15a3da
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看板
提交
dc15a3da
编写于
8月 05, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt rpc send/recv
上级
876443bb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
66 deletion
+13
-66
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+3
-13
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+10
-53
未找到文件。
source/libs/transport/inc/transComm.h
浏览文件 @
dc15a3da
...
...
@@ -127,7 +127,7 @@ typedef struct {
int8_t
retryCnt
;
int8_t
retryLimit
;
// bool setMaxRetry;
STransCtx
appCtx
;
//
STransMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
...
...
@@ -194,17 +194,7 @@ typedef enum { ConnNormal, ConnAcquire, ConnRelease, ConnBroken, ConnInPool } Co
#define transLabel(trans) ((STrans*)trans)->label
// int rpcAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey);
// void rpcBuildAuthHead(void* pMsg, int msgLen, void* pAuth, void* pKey);
//// int32_t rpcCompressRpcMsg(char* pCont, int32_t contLen);
//
// int transAuthenticateMsg(void* pMsg, int msgLen, void* pAuth, void* pKey);
// void transBuildAuthHead(void* pMsg, int msgLen, void* pAuth, void* pKey);
// bool transCompressMsg(char* msg, int32_t len, int32_t* flen);
// bool transDecompressMsg(char* msg, int32_t len, int32_t* flen);
void
transFreeMsg
(
void
*
msg
);
//
typedef
struct
SConnBuffer
{
char
*
buf
;
...
...
@@ -321,8 +311,8 @@ void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType);
// request list
typedef
struct
STransReq
{
queue
q
;
void
*
data
;
queue
q
;
uv_write_t
wreq
;
}
STransReq
;
void
transReqQueueInit
(
queue
*
q
);
...
...
source/libs/transport/src/transComm.c
浏览文件 @
dc15a3da
...
...
@@ -23,33 +23,6 @@ static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
static
int32_t
refMgt
;
static
int32_t
instMgt
;
int
transAuthenticateMsg
(
void
*
pMsg
,
int
msgLen
,
void
*
pAuth
,
void
*
pKey
)
{
T_MD5_CTX
context
;
int
ret
=
-
1
;
tMD5Init
(
&
context
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_PASSWORD_LEN
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pMsg
,
msgLen
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_PASSWORD_LEN
);
tMD5Final
(
&
context
);
if
(
memcmp
(
context
.
digest
,
pAuth
,
sizeof
(
context
.
digest
))
==
0
)
ret
=
0
;
return
ret
;
}
void
transBuildAuthHead
(
void
*
pMsg
,
int
msgLen
,
void
*
pAuth
,
void
*
pKey
)
{
T_MD5_CTX
context
;
tMD5Init
(
&
context
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_PASSWORD_LEN
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pMsg
,
msgLen
);
tMD5Update
(
&
context
,
(
uint8_t
*
)
pKey
,
TSDB_PASSWORD_LEN
);
tMD5Final
(
&
context
);
memcpy
(
pAuth
,
context
.
digest
,
sizeof
(
context
.
digest
));
}
bool
transCompressMsg
(
char
*
msg
,
int32_t
len
,
int32_t
*
flen
)
{
return
false
;
// SRpcHead* pHead = rpcHeadFromCont(pCont);
...
...
@@ -176,7 +149,6 @@ int transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf) {
* info--->|
*/
SConnBuffer
*
p
=
connBuf
;
uvBuf
->
base
=
p
->
buf
+
p
->
len
;
if
(
p
->
left
==
-
1
)
{
uvBuf
->
len
=
p
->
cap
-
p
->
len
;
...
...
@@ -267,14 +239,9 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
uv_async_t
*
async
=
&
(
pool
->
asyncs
[
idx
]);
SAsyncItem
*
item
=
async
->
data
;
int64_t
st
=
taosGetTimestampUs
();
taosThreadMutexLock
(
&
item
->
mtx
);
QUEUE_PUSH
(
&
item
->
qmsg
,
q
);
taosThreadMutexUnlock
(
&
item
->
mtx
);
int64_t
el
=
taosGetTimestampUs
()
-
st
;
if
(
el
>
50
)
{
// tInfo("lock and unlock cost:%d", (int)el);
}
return
uv_async_send
(
async
);
}
...
...
@@ -350,30 +317,21 @@ void transReqQueueInit(queue* q) {
QUEUE_INIT
(
q
);
}
void
*
transReqQueuePush
(
queue
*
q
)
{
uv_write_t
*
req
=
taosMemoryCalloc
(
1
,
sizeof
(
uv_write_t
));
STransReq
*
wreq
=
taosMemoryCalloc
(
1
,
sizeof
(
STransReq
));
wreq
->
data
=
req
;
req
->
data
=
wreq
;
QUEUE_PUSH
(
q
,
&
wreq
->
q
);
return
req
;
STransReq
*
req
=
taosMemoryCalloc
(
1
,
sizeof
(
STransReq
));
req
->
wreq
.
data
=
req
;
QUEUE_PUSH
(
q
,
&
req
->
q
);
return
&
req
->
wreq
;
}
void
*
transReqQueueRemove
(
void
*
arg
)
{
void
*
ret
=
NULL
;
uv_write_t
*
req
=
arg
;
STransReq
*
wreq
=
req
&&
req
->
data
?
req
->
data
:
NULL
;
assert
(
wreq
->
data
==
req
);
if
(
wreq
==
NULL
||
wreq
->
data
==
NULL
)
{
taosMemoryFree
(
wreq
->
data
);
taosMemoryFree
(
wreq
);
return
req
;
}
uv_write_t
*
wreq
=
arg
;
QUEUE_REMOVE
(
&
wreq
->
q
);
STransReq
*
req
=
wreq
?
wreq
->
data
:
NULL
;
if
(
req
==
NULL
)
return
NULL
;
QUEUE_REMOVE
(
&
req
->
q
);
ret
=
req
&&
req
->
handle
?
req
->
handle
->
data
:
NULL
;
taosMemoryFree
(
wreq
->
data
);
taosMemoryFree
(
wreq
);
ret
=
wreq
&&
wreq
->
handle
?
wreq
->
handle
->
data
:
NULL
;
taosMemoryFree
(
req
);
return
ret
;
}
...
...
@@ -382,7 +340,6 @@ void transReqQueueClear(queue* q) {
queue
*
h
=
QUEUE_HEAD
(
q
);
QUEUE_REMOVE
(
h
);
STransReq
*
req
=
QUEUE_DATA
(
h
,
STransReq
,
q
);
taosMemoryFree
(
req
->
data
);
taosMemoryFree
(
req
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录