1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

support server cycle handler. 2.0.153.

This commit is contained in:
winlin 2015-03-31 18:06:55 +08:00
parent 3b4bd194b6
commit 717d088376
10 changed files with 85 additions and 15 deletions

View file

@ -170,6 +170,25 @@ private:
static void sig_catcher(int signo);
};
/**
* the handler to the handle cycle in SRS RTMP server.
*/
class ISrsServerCycle
{
public:
ISrsServerCycle();
virtual ~ISrsServerCycle();
public:
/**
* initialize the cycle handler.
*/
virtual int initialize() = 0;
/**
* do on_cycle while server doing cycle.
*/
virtual int on_cycle(int connections) = 0;
};
/**
* SRS RTMP server, initialize and listen,
* start connection service thread, destroy client.
@ -211,6 +230,10 @@ private:
*/
SrsSignalManager* signal_manager;
/**
* handle in server cycle.
*/
ISrsServerCycle* handler;
/**
* user send the signal, convert to variable.
*/
bool signal_reload;
@ -227,7 +250,7 @@ public:
virtual void destroy();
// server startup workflow, @see run_master()
public:
virtual int initialize();
virtual int initialize(ISrsServerCycle* cycle_handler);
virtual int initialize_signal();
virtual int acquire_pid_file();
virtual int initialize_st();