Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d47b358b
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看板
提交
d47b358b
编写于
4月 22, 2021
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3909]<fix>: [http/race] fix singleCmd race issue
上级
ec79d6a7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
9 deletion
+11
-9
src/plugins/http/inc/httpContext.h
src/plugins/http/inc/httpContext.h
+1
-1
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+5
-5
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+3
-3
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+2
-0
未找到文件。
src/plugins/http/inc/httpContext.h
浏览文件 @
d47b358b
...
...
@@ -25,7 +25,7 @@ const char *httpContextStateStr(HttpContextState state);
HttpContext
*
httpCreateContext
(
SOCKET
fd
);
bool
httpInitContext
(
HttpContext
*
pContext
);
HttpContext
*
httpGetContext
(
void
*
pContext
);
void
httpReleaseContext
(
HttpContext
*
pContext
,
bool
clearRes
);
void
httpReleaseContext
(
HttpContext
*
pContext
/*, bool clearRes*/
);
void
httpCloseContextByServer
(
HttpContext
*
pContext
);
void
httpCloseContextByApp
(
HttpContext
*
pContext
);
void
httpNotifyContextClose
(
HttpContext
*
pContext
);
...
...
src/plugins/http/src/httpContext.c
浏览文件 @
d47b358b
...
...
@@ -146,20 +146,20 @@ HttpContext *httpGetContext(void *ptr) {
return
NULL
;
}
void
httpReleaseContext
(
HttpContext
*
pContext
,
bool
clearRes
)
{
void
httpReleaseContext
(
HttpContext
*
pContext
/*, bool clearRes*/
)
{
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pContext
->
refCount
,
1
);
if
(
refCount
<
0
)
{
httpError
(
"context:%p, is already released, refCount:%d"
,
pContext
,
refCount
);
return
;
}
/*
if (clearRes) {
if (pContext->parser) {
httpClearParser(pContext->parser);
}
memset(&pContext->singleCmd, 0, sizeof(HttpSqlCmd));
}
*/
HttpContext
**
ppContext
=
pContext
->
ppContext
;
httpTrace
(
"context:%p, is released, data:%p refCount:%d"
,
pContext
,
ppContext
,
refCount
);
...
...
@@ -217,7 +217,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
}
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
}
void
httpCloseContextByServer
(
HttpContext
*
pContext
)
{
...
...
@@ -235,5 +235,5 @@ void httpCloseContextByServer(HttpContext *pContext) {
pContext
->
parsed
=
false
;
httpRemoveContextFromEpoll
(
pContext
);
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
}
src/plugins/http/src/httpServer.c
浏览文件 @
d47b358b
...
...
@@ -177,7 +177,7 @@ static void httpProcessHttpData(void *param) {
if
(
!
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_READY
))
{
httpDebug
(
"context:%p, fd:%d, state:%s, not in ready state, ignore read events"
,
pContext
,
pContext
->
fd
,
httpContextStateStr
(
pContext
->
state
));
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
continue
;
}
...
...
@@ -191,7 +191,7 @@ static void httpProcessHttpData(void *param) {
(
*
(
pThread
->
processData
))(
pContext
);
atomic_fetch_add_32
(
&
pServer
->
requestNum
,
1
);
}
else
{
httpReleaseContext
(
pContext
,
false
);
httpReleaseContext
(
pContext
/*, false*/
);
}
}
}
...
...
@@ -275,7 +275,7 @@ static void *httpAcceptHttpConnection(void *arg) {
httpError
(
"context:%p, fd:%d, ip:%s, thread:%s, failed to add http fd for epoll, error:%s"
,
pContext
,
connFd
,
pContext
->
ipstr
,
pThread
->
label
,
strerror
(
errno
));
taosCloseSocket
(
pContext
->
fd
);
httpReleaseContext
(
pContext
,
true
);
httpReleaseContext
(
pContext
/*, true*/
);
continue
;
}
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
d47b358b
...
...
@@ -376,6 +376,8 @@ void httpExecCmd(HttpContext *pContext) {
httpCloseContextByApp
(
pContext
);
break
;
}
memset
(
&
pContext
->
singleCmd
,
0
,
sizeof
(
HttpSqlCmd
));
}
void
httpProcessRequestCb
(
void
*
param
,
TAOS_RES
*
result
,
int32_t
code
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录