Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8d1ddbd8
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看板
提交
8d1ddbd8
编写于
5月 14, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: remove from task queue before signalling caller
上级
1e32228d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
14 deletion
+26
-14
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+26
-14
未找到文件。
source/libs/function/src/tudf.c
浏览文件 @
8d1ddbd8
...
...
@@ -964,7 +964,7 @@ void udfcUvHandleError(SClientUvConn *conn) {
uv_close
((
uv_handle_t
*
)
conn
->
pipe
,
onUdfcPipeClose
);
}
void
onUdfcRead
(
uv_stream_t
*
client
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
void
onUdfc
Pipe
Read
(
uv_stream_t
*
client
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
fnTrace
(
"udfc client %p, client read from pipe. nread: %zd"
,
client
,
nread
);
if
(
nread
==
0
)
return
;
...
...
@@ -987,30 +987,32 @@ void onUdfcRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) {
}
void
onUdf
Clien
tWrite
(
uv_write_t
*
write
,
int
status
)
{
void
onUdf
cPipe
tWrite
(
uv_write_t
*
write
,
int
status
)
{
SClientUvTaskNode
*
uvTask
=
write
->
data
;
uv_pipe_t
*
pipe
=
uvTask
->
pipe
;
fnTrace
(
"udfc client %p write length:%zu"
,
pipe
,
uvTask
->
reqBuf
.
len
);
SClientUvConn
*
conn
=
pipe
->
data
;
if
(
status
==
0
)
{
SClientUvConn
*
conn
=
pipe
->
data
;
QUEUE_INSERT_TAIL
(
&
conn
->
taskQueue
,
&
uvTask
->
connTaskQueue
);
}
else
{
fnError
(
"udfc client %p write error."
,
pipe
);
udfcUvHandleError
(
conn
);
}
fnTrace
(
"udfc client %p write length:%zu"
,
pipe
,
uvTask
->
reqBuf
.
len
);
taosMemoryFree
(
write
);
taosMemoryFree
(
uvTask
->
reqBuf
.
base
);
}
void
onUdf
Client
Connect
(
uv_connect_t
*
connect
,
int
status
)
{
void
onUdf
cPipe
Connect
(
uv_connect_t
*
connect
,
int
status
)
{
SClientUvTaskNode
*
uvTask
=
connect
->
data
;
uvTask
->
errCode
=
status
;
if
(
status
!=
0
)
{
//TODO: LOG error
fnError
(
"client connect error, task seq: %"
PRId64
", code: %s"
,
uvTask
->
seqNum
,
uv_strerror
(
status
));
}
uv_read_start
((
uv_stream_t
*
)
uvTask
->
pipe
,
udfcAllocateBuffer
,
onUdfcRead
);
uvTask
->
errCode
=
status
;
uv_read_start
((
uv_stream_t
*
)
uvTask
->
pipe
,
udfcAllocateBuffer
,
onUdfcPipeRead
);
taosMemoryFree
(
connect
);
uv_sem_post
(
&
uvTask
->
taskSem
);
QUEUE_REMOVE
(
&
uvTask
->
procTaskQueue
);
uv_sem_post
(
&
uvTask
->
taskSem
);
}
int32_t
udfcCreateUvTask
(
SClientUdfTask
*
task
,
int8_t
uvTaskType
,
SClientUvTaskNode
**
pUvTask
)
{
...
...
@@ -1070,6 +1072,7 @@ int32_t udfcQueueUvTask(SClientUvTaskNode *uvTask) {
int32_t
udfcStartUvTask
(
SClientUvTaskNode
*
uvTask
)
{
fnTrace
(
"event loop start uv task. task: %d, %p"
,
uvTask
->
type
,
uvTask
);
int32_t
code
=
0
;
switch
(
uvTask
->
type
)
{
case
UV_TASK_CONNECT
:
{
uv_pipe_t
*
pipe
=
taosMemoryMalloc
(
sizeof
(
uv_pipe_t
));
...
...
@@ -1088,28 +1091,35 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
uv_connect_t
*
connReq
=
taosMemoryMalloc
(
sizeof
(
uv_connect_t
));
connReq
->
data
=
uvTask
;
uv_pipe_connect
(
connReq
,
pipe
,
uvTask
->
udfc
->
udfdPipeName
,
onUdfClientConnect
);
uv_pipe_connect
(
connReq
,
pipe
,
uvTask
->
udfc
->
udfdPipeName
,
onUdfcPipeConnect
);
code
=
0
;
break
;
}
case
UV_TASK_REQ_RSP
:
{
uv_pipe_t
*
pipe
=
uvTask
->
pipe
;
uv_write_t
*
write
=
taosMemoryMalloc
(
sizeof
(
uv_write_t
));
write
->
data
=
uvTask
;
uv_write
(
write
,
(
uv_stream_t
*
)
pipe
,
&
uvTask
->
reqBuf
,
1
,
onUdfClientWrite
);
int
err
=
uv_write
(
write
,
(
uv_stream_t
*
)
pipe
,
&
uvTask
->
reqBuf
,
1
,
onUdfcPipetWrite
);
if
(
err
!=
0
)
{
fnError
(
"udfc event loop start req/rsp task uv_write failed. code: %s"
,
uv_strerror
(
err
));
}
code
=
err
;
break
;
}
case
UV_TASK_DISCONNECT
:
{
SClientUvConn
*
conn
=
uvTask
->
pipe
->
data
;
QUEUE_INSERT_TAIL
(
&
conn
->
taskQueue
,
&
uvTask
->
connTaskQueue
);
uv_close
((
uv_handle_t
*
)
uvTask
->
pipe
,
onUdfcPipeClose
);
code
=
0
;
break
;
}
default:
{
fnError
(
"udfc event loop unknown task type."
)
break
;
}
}
return
0
;
return
code
;
}
void
udfClientAsyncCb
(
uv_async_t
*
async
)
{
...
...
@@ -1124,8 +1134,10 @@ void udfClientAsyncCb(uv_async_t *async) {
QUEUE
*
h
=
QUEUE_HEAD
(
&
wq
);
QUEUE_REMOVE
(
h
);
SClientUvTaskNode
*
task
=
QUEUE_DATA
(
h
,
SClientUvTaskNode
,
recvTaskQueue
);
udfcStartUvTask
(
task
);
QUEUE_INSERT_TAIL
(
&
udfc
->
uvProcTaskQueue
,
&
task
->
procTaskQueue
);
int32_t
code
=
udfcStartUvTask
(
task
);
if
(
code
==
0
)
{
QUEUE_INSERT_TAIL
(
&
udfc
->
uvProcTaskQueue
,
&
task
->
procTaskQueue
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录