mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
merge srs2, support oryx
This commit is contained in:
commit
0e308b0fa1
7 changed files with 63 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue