Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-06-09 11:19:28 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d317528af989314f37268914dfd00d8404a90a67
d317528a
1 parent
7996b3b7
refine the signal manager.
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
17 行增加
和
15 行删除
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.cpp
查看文件 @
d317528
...
...
@@ -374,8 +374,6 @@ SrsSignalManager::SrsSignalManager(SrsServer* server)
SrsSignalManager
::~
SrsSignalManager
()
{
srs_freep
(
pthread
);
srs_close_stfd
(
signal_read_stfd
);
if
(
sig_pipe
[
0
]
>
0
)
{
...
...
@@ -384,18 +382,32 @@ SrsSignalManager::~SrsSignalManager()
if
(
sig_pipe
[
1
]
>
0
)
{
::
close
(
sig_pipe
[
1
]);
}
srs_freep
(
pthread
);
}
int
SrsSignalManager
::
initialize
()
{
int
ret
=
ERROR_SUCCESS
;
/* Create signal pipe */
if
(
pipe
(
sig_pipe
)
<
0
)
{
ret
=
ERROR_SYSTEM_CREATE_PIPE
;
srs_error
(
"create signal manager pipe failed. ret=%d"
,
ret
);
return
ret
;
}
if
((
signal_read_stfd
=
st_netfd_open
(
sig_pipe
[
0
]))
==
NULL
)
{
ret
=
ERROR_SYSTEM_CREATE_PIPE
;
srs_error
(
"create signal manage st pipe failed. ret=%d"
,
ret
);
return
ret
;
}
return
ret
;
}
int
SrsSignalManager
::
start
()
{
int
ret
=
ERROR_SUCCESS
;
/**
* Note that if multiple processes are used (see below),
* the signal pipe should be initialized after the fork(2) call
...
...
@@ -403,13 +415,6 @@ int SrsSignalManager::start()
*/
struct
sigaction
sa
;
/* Create signal pipe */
if
(
pipe
(
sig_pipe
)
<
0
)
{
ret
=
ERROR_SYSTEM_CREATE_PIPE
;
srs_error
(
"create signal manager pipe failed. ret=%d"
,
ret
);
return
ret
;
}
/* Install sig_catcher() as a signal handler */
sa
.
sa_handler
=
SrsSignalManager
::
sig_catcher
;
sigemptyset
(
&
sa
.
sa_mask
);
...
...
@@ -439,10 +444,6 @@ int SrsSignalManager::start()
int
SrsSignalManager
::
cycle
()
{
int
ret
=
ERROR_SUCCESS
;
if
(
signal_read_stfd
==
NULL
)
{
signal_read_stfd
=
st_netfd_open
(
sig_pipe
[
0
]);
}
int
signo
;
...
...
@@ -852,6 +853,7 @@ int SrsServer::cycle()
#else
srs_warn
(
"main cycle terminated, system quit normally."
);
dispose
();
srs_trace
(
"srs terminated"
);
exit
(
0
);
#endif
...
...
请
注册
或
登录
后发表评论