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
2016-09-23 15:33:43 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
0e308b0fa1d4cf6da18332c5dd301067aab4d0ac
0e308b0f
2 parents
b5d466f3
07fe35f1
merge srs2, support oryx
显示空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
62 行增加
和
5 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/core/srs_core.hpp
trunk/src/main/srs_main_server.cpp
trunk/conf/full.conf
查看文件 @
0e308b0
...
...
@@ -55,6 +55,19 @@ utc_time off;
# default: 10000
pithy_print_ms
10000
;
# the work dir for server, to chdir(work_dir) when not empty or "./"
# user can config this directory to change the dir.
# @reamrk do not support reload.
# default: ./
work_dir
./;
# whether quit when parent process changed,
# used for supervisor mode(not daemon), srs should always quit when
# supervisor process exited.
# @remark conflict with daemon, error when both daemon and asprocess are on.
# @reamrk do not support reload.
# default: off
asprocess
off
;
#############################################################################################
# heartbeat/stats sections
#############################################################################################
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
0e308b0
...
...
@@ -3536,7 +3536,7 @@ int SrsConfig::check_config()
&&
n
!=
"max_connections"
&&
n
!=
"daemon"
&&
n
!=
"heartbeat"
&&
n
!=
"http_api"
&&
n
!=
"stats"
&&
n
!=
"vhost"
&&
n
!=
"pithy_print_ms"
&&
n
!=
"http_server"
&&
n
!=
"stream_caster"
&&
n
!=
"kafka"
&&
n
!=
"utc_time"
&&
n
!=
"work_dir"
&&
n
!=
"utc_time"
&&
n
!=
"work_dir"
&&
n
!=
"asprocess"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported directive %s, ret=%d"
,
n
.
c_str
(),
ret
);
...
...
@@ -4065,6 +4065,13 @@ int SrsConfig::check_config()
// TODO: FIXME: required http server when hls storage is ram or both.
}
// asprocess conflict with daemon
if
(
get_asprocess
()
&&
get_deamon
())
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"daemon conflict with asprocess, ret=%d"
,
ret
);
return
ret
;
}
return
ret
;
}
...
...
@@ -4195,6 +4202,20 @@ string SrsConfig::get_work_dir() {
}
return
conf
->
arg0
();
return
conf
->
arg0
();
}
bool
SrsConfig
::
get_asprocess
()
{
static
bool
DEFAULT
=
false
;
SrsConfDirective
*
conf
=
root
->
get
(
"asprocess"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
return
SRS_CONF_PERFER_FALSE
(
conf
->
arg0
());
}
vector
<
SrsConfDirective
*>
SrsConfig
::
get_stream_casters
()
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
0e308b0
...
...
@@ -618,6 +618,8 @@ public:
* ignore if empty string.
*/
virtual
std
::
string
get_work_dir
();
// whether use asprocess mode.
virtual
bool
get_asprocess
();
// stream_caster section
public:
/**
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
0e308b0
...
...
@@ -494,6 +494,7 @@ SrsServer::SrsServer()
signal_manager
=
NULL
;
handler
=
NULL
;
ppid
=
::
getppid
();
// donot new object in constructor,
// for some global instance is not ready now,
...
...
@@ -653,7 +654,16 @@ int SrsServer::initialize_st()
// set current log id.
_srs_context
->
generate_id
();
srs_trace
(
"server main cid=%d"
,
_srs_context
->
get_id
());
// check asprocess.
bool
asprocess
=
_srs_config
->
get_asprocess
();
if
(
ppid
==
1
)
{
ret
=
ERROR_SYSTEM_ASSERT_FAILED
;
srs_error
(
"for asprocess, ppid should never be init(1), ret=%d"
,
ret
);
return
ret
;
}
srs_trace
(
"server main cid=%d, pid=%d, ppid=%d, asprocess=%d"
,
_srs_context
->
get_id
(),
::
getpid
(),
ppid
,
asprocess
);
return
ret
;
}
...
...
@@ -964,6 +974,9 @@ int SrsServer::do_cycle()
max
=
srs_max
(
max
,
SRS_SYS_NETWORK_RTMP_SERVER_RESOLUTION_TIMES
);
#endif
// for asprocess.
bool
asprocess
=
_srs_config
->
get_asprocess
();
// the deamon thread, update the time cache
// TODO: FIXME: use SrsHourGlass.
while
(
true
)
{
...
...
@@ -981,7 +994,13 @@ int SrsServer::do_cycle()
for
(
int
i
=
0
;
i
<
dynamic_max
;
i
++
)
{
st_usleep
(
SRS_SYS_CYCLE_INTERVAL
*
1000
);
// gracefully quit for SIGINT or SIGTERM(SRS_SIGNAL_GRACEFULLY_QUIT).
// asprocess check.
if
(
asprocess
&&
::
getppid
()
!=
ppid
)
{
srs_warn
(
"asprocess ppid changed from %d to %d"
,
ppid
,
::
getppid
());
return
ret
;
}
// gracefully quit for SIGINT or SIGTERM.
if
(
signal_gracefully_quit
)
{
srs_trace
(
"cleanup for gracefully terminate."
);
return
ret
;
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
0e308b0
...
...
@@ -288,6 +288,8 @@ private:
bool
signal_persistence_config
;
bool
signal_gmc_stop
;
bool
signal_gracefully_quit
;
// parent pid for asprocess.
int
ppid
;
public
:
SrsServer
();
virtual
~
SrsServer
();
...
...
trunk/src/core/srs_core.hpp
查看文件 @
0e308b0
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 21
7
#define VERSION_REVISION 21
8
// generated by configure, only macros.
#include <srs_auto_headers.hpp>
...
...
trunk/src/main/srs_main_server.cpp
查看文件 @
0e308b0
...
...
@@ -264,7 +264,7 @@ int main(int argc, char** argv)
// change the work dir and set cwd.
string
cwd
=
_srs_config
->
get_work_dir
();
if
(
!
cwd
.
empty
()
&&
(
ret
=
chdir
(
cwd
.
c_str
()))
!=
ERROR_SUCCESS
)
{
if
(
!
cwd
.
empty
()
&&
cwd
!=
"./"
&&
(
ret
=
chdir
(
cwd
.
c_str
()))
!=
ERROR_SUCCESS
)
{
srs_error
(
"change cwd to %s failed. ret=%d"
,
cwd
.
c_str
(),
ret
);
return
ret
;
}
...
...
请
注册
或
登录
后发表评论