Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d9c04b18
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看板
提交
d9c04b18
编写于
8月 01, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
elog to util; parser.data.pos
上级
521d7c15
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
4 deletion
+34
-4
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+10
-3
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+24
-1
src/util/inc/elog.h
src/util/inc/elog.h
+0
-0
src/util/src/elog.c
src/util/src/elog.c
+0
-0
未找到文件。
src/plugins/http/src/httpContext.c
浏览文件 @
d9c04b18
...
...
@@ -55,6 +55,7 @@ static void httpRemoveContextFromEpoll(HttpContext *pContext) {
static
void
httpDestroyContext
(
void
*
data
)
{
HttpContext
*
pContext
=
*
(
HttpContext
**
)
data
;
D
(
"==context[%p] destroyed=="
,
pContext
);
if
(
pContext
->
fd
>
0
)
tclose
(
pContext
->
fd
);
HttpThread
*
pThread
=
pContext
->
pThread
;
...
...
@@ -80,6 +81,7 @@ bool httpInitContexts() {
httpError
(
"failed to init context cache"
);
return
false
;
}
D
(
"==cache [%p] created=="
,
tsHttpServer
.
contextCache
);
return
true
;
}
...
...
@@ -120,6 +122,8 @@ HttpContext *httpCreateContext(int32_t fd) {
HttpContext
*
pContext
=
calloc
(
1
,
sizeof
(
HttpContext
));
if
(
pContext
==
NULL
)
return
NULL
;
D
(
"==context[%p] created=="
,
pContext
);
pContext
->
fd
=
fd
;
pContext
->
httpVersion
=
HTTP_VERSION_10
;
pContext
->
lastAccessTime
=
taosGetTimestampSec
();
...
...
@@ -209,6 +213,7 @@ bool httpInitContext(HttpContext *pContext) {
}
void
httpCloseContextByApp
(
HttpContext
*
pContext
)
{
D
(
"=="
);
pContext
->
parsed
=
false
;
bool
keepAlive
=
true
;
...
...
@@ -220,6 +225,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
}
if
(
keepAlive
)
{
D
(
"==keepAlive=="
);
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_HANDLING
,
HTTP_CONTEXT_STATE_READY
))
{
httpDebug
(
"context:%p, fd:%d, ip:%s, last state:handling, keepAlive:true, reuse context"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
);
...
...
@@ -240,6 +246,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
pContext
->
ipstr
,
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
}
}
else
{
D
(
"==not keepAlive=="
);
httpRemoveContextFromEpoll
(
pContext
);
httpDebug
(
"context:%p, fd:%d, ip:%s, last state:%s:%d, keepAlive:false, close context"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
...
...
@@ -365,9 +372,7 @@ static void on_body(void *arg, const char *chunk, size_t len) {
if
(
pParser
->
failed
)
return
;
if
(
!
pContext
->
parsed
)
{
pContext
->
parsed
=
true
;
}
if
(
pParser
->
data
.
pos
==
0
)
pParser
->
data
.
pos
=
pParser
->
pLast
;
A
(
"not implemented yet"
);
}
...
...
@@ -378,6 +383,8 @@ static void on_end(void *arg) {
if
(
pParser
->
failed
)
return
;
if
(
pParser
->
data
.
pos
==
0
)
pParser
->
data
.
pos
=
pParser
->
pLast
;
if
(
!
pContext
->
parsed
)
{
pContext
->
parsed
=
true
;
}
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
d9c04b18
...
...
@@ -138,7 +138,7 @@ static bool httpDecompressData(HttpContext *pContext) {
}
static
bool
httpReadData
(
HttpContext
*
pContext
)
{
if
(
1
)
return
ehttpReadData
(
pContext
);
if
(
0
)
return
ehttpReadData
(
pContext
);
if
(
!
pContext
->
parsed
)
{
httpInitContext
(
pContext
);
...
...
@@ -447,6 +447,29 @@ static bool ehttpReadData(HttpContext *pContext) {
httpNotifyContextClose
(
pContext
);
return
false
;
}
if
(
pContext
->
parsed
)
{
int
ret
=
httpCheckReadCompleted
(
pContext
);
if
(
ret
==
HTTP_CHECK_BODY_CONTINUE
)
{
//httpDebug("context:%p, fd:%d, ip:%s, not finished yet, wait another event", pContext, pContext->fd, pContext->ipstr);
httpReleaseContext
(
pContext
);
return
false
;
}
else
if
(
ret
==
HTTP_CHECK_BODY_SUCCESS
){
httpDebug
(
"context:%p, fd:%d, ip:%s, thread:%s, read size:%d, dataLen:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
pThread
->
label
,
pContext
->
parser
.
bufsize
,
pContext
->
parser
.
data
.
len
);
if
(
httpDecompressData
(
pContext
))
{
return
true
;
}
else
{
httpNotifyContextClose
(
pContext
);
httpReleaseContext
(
pContext
);
return
false
;
}
}
else
{
httpError
(
"context:%p, fd:%d, ip:%s, failed to read http body, close connect"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
);
httpNotifyContextClose
(
pContext
);
httpReleaseContext
(
pContext
);
return
false
;
}
}
return
pContext
->
parsed
;
}
else
if
(
nread
<
0
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
...
...
src/
common
/inc/elog.h
→
src/
util
/inc/elog.h
浏览文件 @
d9c04b18
文件已移动
src/
common
/src/elog.c
→
src/
util
/src/elog.c
浏览文件 @
d9c04b18
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录