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

refine main object(server, config, log, context), handler reload in intialize(), change to 0.9.59

This commit is contained in:
winlin 2014-04-12 20:35:40 +08:00
parent 7c64a893f5
commit b38df9cd1a
8 changed files with 90 additions and 63 deletions

View file

@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <fcntl.h>
#include <srs_app_config.hpp>
#include <srs_kernel_error.hpp>
SrsThreadContext::SrsThreadContext()
{
@ -65,8 +66,6 @@ SrsFastLog::SrsFastLog()
log_data = new char[LOG_MAX_SIZE];
fd = -1;
// TODO: support reload.
}
SrsFastLog::~SrsFastLog()
@ -79,6 +78,12 @@ SrsFastLog::~SrsFastLog()
}
}
int SrsFastLog::initialize()
{
// TODO: support reload.
return ERROR_SUCCESS;
}
int SrsFastLog::level()
{
return _level;

View file

@ -69,6 +69,7 @@ public:
SrsFastLog();
virtual ~SrsFastLog();
public:
virtual int initialize();
virtual int level();
virtual void set_level(int level);
virtual void verbose(const char* tag, int context_id, const char* fmt, ...);

View file

@ -160,9 +160,6 @@ SrsServer::SrsServer()
signal_reload = false;
signal_gmc_stop = false;
srs_assert(_srs_config);
_srs_config->subscribe(this);
// donot new object in constructor,
// for some global instance is not ready now,
// new these objects in initialize instead.
@ -208,6 +205,12 @@ int SrsServer::initialize()
{
int ret = ERROR_SUCCESS;
// for the main objects(server, config, log),
// never subscribe handler in constructor,
// instead, subscribe handler in initialize method.
srs_assert(_srs_config);
_srs_config->subscribe(this);
#ifdef SRS_HTTP_API
srs_assert(!http_api_handler);
http_api_handler = SrsHttpHandler::create_http_api();