Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f8ee5fc4
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f8ee5fc4
编写于
1月 17, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1207
上级
9fbe6e47
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
1 deletion
+40
-1
src/plugins/http/inc/httpInt.h
src/plugins/http/inc/httpInt.h
+2
-0
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+5
-0
src/plugins/http/src/httpSystem.c
src/plugins/http/src/httpSystem.c
+5
-0
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+15
-1
src/sync/src/syncTcp.c
src/sync/src/syncTcp.c
+13
-0
未找到文件。
src/plugins/http/inc/httpInt.h
浏览文件 @
f8ee5fc4
...
...
@@ -177,6 +177,8 @@ typedef struct HttpServer {
char
label
[
HTTP_LABEL_SIZE
];
uint32_t
serverIp
;
uint16_t
serverPort
;
int8_t
stop
;
int8_t
reserve
;
SOCKET
fd
;
int32_t
numOfThreads
;
int32_t
methodScannerLen
;
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
f8ee5fc4
...
...
@@ -171,6 +171,11 @@ static void *httpAcceptHttpConnection(void *arg) {
while
(
1
)
{
socklen_t
addrlen
=
sizeof
(
clientAddr
);
connFd
=
(
int32_t
)
accept
(
pServer
->
fd
,
(
struct
sockaddr
*
)
&
clientAddr
,
&
addrlen
);
if
(
pServer
->
stop
)
{
httpDebug
(
"http server:%s socket stop, exiting..."
,
pServer
->
label
);
break
;
}
if
(
connFd
==
-
1
)
{
if
(
errno
==
EINVAL
)
{
httpDebug
(
"http server:%s socket was shutdown, exiting..."
,
pServer
->
label
);
...
...
src/plugins/http/src/httpSystem.c
浏览文件 @
f8ee5fc4
...
...
@@ -89,7 +89,12 @@ int32_t httpStartSystem() {
void
httpStopSystem
()
{
tsHttpServer
.
status
=
HTTP_SERVER_CLOSING
;
tsHttpServer
.
stop
=
1
;
#ifdef WINDOWS
closesocket
(
tsHttpServer
.
fd
);
#else
shutdown
(
tsHttpServer
.
fd
,
SHUT_RD
);
#endif
tgCleanupHandle
();
}
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
f8ee5fc4
...
...
@@ -59,6 +59,8 @@ typedef struct {
SOCKET
fd
;
uint32_t
ip
;
uint16_t
port
;
int8_t
stop
;
int8_t
reserve
;
char
label
[
TSDB_LABEL_LEN
];
int
numOfThreads
;
void
*
shandle
;
...
...
@@ -188,8 +190,15 @@ void taosStopTcpServer(void *handle) {
SServerObj
*
pServerObj
=
handle
;
if
(
pServerObj
==
NULL
)
return
;
if
(
pServerObj
->
fd
>=
0
)
shutdown
(
pServerObj
->
fd
,
SHUT_RD
)
;
pServerObj
->
stop
=
1
;
if
(
pServerObj
->
fd
>=
0
)
{
#ifdef WINDOWS
closesocket
(
pServerObj
->
fd
);
#else
shutdown
(
pServerObj
->
fd
,
SHUT_RD
);
#endif
}
if
(
taosCheckPthreadValid
(
pServerObj
->
thread
))
{
if
(
taosComparePthread
(
pServerObj
->
thread
,
pthread_self
()))
{
pthread_detach
(
pthread_self
());
...
...
@@ -230,6 +239,11 @@ static void *taosAcceptTcpConnection(void *arg) {
while
(
1
)
{
socklen_t
addrlen
=
sizeof
(
caddr
);
connFd
=
accept
(
pServerObj
->
fd
,
(
struct
sockaddr
*
)
&
caddr
,
&
addrlen
);
if
(
pServerObj
->
stop
)
{
tDebug
(
"%s TCP server stop accepting new connections"
,
pServerObj
->
label
);
break
;
}
if
(
connFd
==
-
1
)
{
if
(
errno
==
EINVAL
)
{
tDebug
(
"%s TCP server stop accepting new connections, exiting"
,
pServerObj
->
label
);
...
...
src/sync/src/syncTcp.c
浏览文件 @
f8ee5fc4
...
...
@@ -46,6 +46,7 @@ typedef struct SPoolObj {
pthread_t
thread
;
int32_t
nextId
;
SOCKET
acceptFd
;
// FD for accept new connection
int8_t
stop
;
}
SPoolObj
;
typedef
struct
{
...
...
@@ -106,7 +107,14 @@ void syncCloseTcpThreadPool(void *param) {
SPoolObj
*
pPool
=
param
;
SThreadObj
*
pThread
;
pPool
->
stop
=
1
;
#ifdef WINDOWS
closesocket
(
pPool
->
acceptFd
);
#else
shutdown
(
pPool
->
acceptFd
,
SHUT_RD
);
#endif
pthread_join
(
pPool
->
thread
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
pPool
->
info
.
numOfThreads
;
++
i
)
{
...
...
@@ -257,6 +265,11 @@ static void *syncAcceptPeerTcpConnection(void *argv) {
struct
sockaddr_in
clientAddr
;
socklen_t
addrlen
=
sizeof
(
clientAddr
);
SOCKET
connFd
=
accept
(
pPool
->
acceptFd
,
(
struct
sockaddr
*
)
&
clientAddr
,
&
addrlen
);
if
(
pPool
->
stop
)
{
sDebug
(
"%p TCP server accept is stopped"
,
pPool
);
break
;
}
if
(
connFd
<
0
)
{
if
(
errno
==
EINVAL
)
{
sDebug
(
"%p TCP server accept is exiting..."
,
pPool
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录