mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix bug #34: convert signal to io. 0.9.85
This commit is contained in:
parent
a14220d4fb
commit
d0dff2d332
5 changed files with 166 additions and 15 deletions
|
@ -24,8 +24,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_core.hpp>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
@ -56,13 +54,6 @@ ISrsThreadContext* _srs_context = new SrsThreadContext();
|
|||
SrsConfig* _srs_config = new SrsConfig();
|
||||
SrsServer* _srs_server = new SrsServer();
|
||||
|
||||
// signal handler
|
||||
void handler(int signo)
|
||||
{
|
||||
srs_trace("get a signal, signo=%d", signo);
|
||||
_srs_server->on_signal(signo);
|
||||
}
|
||||
|
||||
// main entrance.
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -166,9 +157,9 @@ int run_master()
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
signal(SIGNAL_RELOAD, handler);
|
||||
signal(SIGTERM, handler);
|
||||
signal(SIGINT, handler);
|
||||
if ((ret = _srs_server->initialize_signal()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = _srs_server->acquire_pid_file()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
|
@ -182,6 +173,10 @@ int run_master()
|
|||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = _srs_server->register_signal()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = _srs_server->ingest()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue