mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
support reload utc_time. 2.0.186
This commit is contained in:
parent
0221434ae9
commit
abd7ee227c
7 changed files with 34 additions and 3 deletions
|
@ -341,6 +341,7 @@ Remark:
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
* v2.0, 2015-09-09, support reload utc_time. 2.0.186
|
||||||
* <strong>v2.0, 2015-08-23, [2.0 alpha(2.0.185)][r2.0a0] released. 89022 lines.</strong>
|
* <strong>v2.0, 2015-08-23, [2.0 alpha(2.0.185)][r2.0a0] released. 89022 lines.</strong>
|
||||||
* v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx.
|
* v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx.
|
||||||
* v2.0, 2015-08-20, fix [#380][bug #380], srs-librtmp send sequence header when sps or pps changed.
|
* v2.0, 2015-08-20, fix [#380][bug #380], srs-librtmp send sequence header when sps or pps changed.
|
||||||
|
|
|
@ -957,12 +957,24 @@ int SrsConfig::reload_conf(SrsConfig* conf)
|
||||||
srs_trace("reload srs_log_file success.");
|
srs_trace("reload srs_log_file success.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// merge config: utc_time
|
||||||
|
if (!srs_directive_equals(root->get("utc_time"), old_root->get("utc_time"))) {
|
||||||
|
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||||
|
ISrsReloadHandler* subscribe = *it;
|
||||||
|
if ((ret = subscribe->on_reload_utc_time()) != ERROR_SUCCESS) {
|
||||||
|
srs_error("notify subscribes reload utc_time failed. ret=%d", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
srs_trace("reload utc_time success.");
|
||||||
|
}
|
||||||
|
|
||||||
// merge config: pithy_print_ms
|
// merge config: pithy_print_ms
|
||||||
if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) {
|
if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) {
|
||||||
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
|
||||||
ISrsReloadHandler* subscribe = *it;
|
ISrsReloadHandler* subscribe = *it;
|
||||||
if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) {
|
if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) {
|
||||||
srs_error("notify subscribes pithy_print_ms listen failed. ret=%d", ret);
|
srs_error("notify subscribes pithy_print_ms failed. ret=%d", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@ SrsFastLog::SrsFastLog()
|
||||||
|
|
||||||
fd = -1;
|
fd = -1;
|
||||||
log_to_file_tank = false;
|
log_to_file_tank = false;
|
||||||
|
utc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsFastLog::~SrsFastLog()
|
SrsFastLog::~SrsFastLog()
|
||||||
|
@ -111,6 +112,7 @@ int SrsFastLog::initialize()
|
||||||
|
|
||||||
log_to_file_tank = _srs_config->get_log_tank_file();
|
log_to_file_tank = _srs_config->get_log_tank_file();
|
||||||
_level = srs_get_log_level(_srs_config->get_log_level());
|
_level = srs_get_log_level(_srs_config->get_log_level());
|
||||||
|
utc = _srs_config->get_utc_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -221,6 +223,13 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...)
|
||||||
write_log(fd, log_data, size, SrsLogLevel::Error);
|
write_log(fd, log_data, size, SrsLogLevel::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SrsFastLog::on_reload_utc_time()
|
||||||
|
{
|
||||||
|
utc = _srs_config->get_utc_time();
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int SrsFastLog::on_reload_log_tank()
|
int SrsFastLog::on_reload_log_tank()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
@ -291,7 +300,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co
|
||||||
|
|
||||||
// to calendar time
|
// to calendar time
|
||||||
struct tm* tm;
|
struct tm* tm;
|
||||||
if (_srs_config && _srs_config->get_utc_time()) {
|
if (utc) {
|
||||||
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ private:
|
||||||
int fd;
|
int fd;
|
||||||
// whether log to file tank
|
// whether log to file tank
|
||||||
bool log_to_file_tank;
|
bool log_to_file_tank;
|
||||||
|
// whether use utc time.
|
||||||
|
bool utc;
|
||||||
public:
|
public:
|
||||||
SrsFastLog();
|
SrsFastLog();
|
||||||
virtual ~SrsFastLog();
|
virtual ~SrsFastLog();
|
||||||
|
@ -85,6 +87,7 @@ public:
|
||||||
virtual void error(const char* tag, int context_id, const char* fmt, ...);
|
virtual void error(const char* tag, int context_id, const char* fmt, ...);
|
||||||
// interface ISrsReloadHandler.
|
// interface ISrsReloadHandler.
|
||||||
public:
|
public:
|
||||||
|
virtual int on_reload_utc_time();
|
||||||
virtual int on_reload_log_tank();
|
virtual int on_reload_log_tank();
|
||||||
virtual int on_reload_log_level();
|
virtual int on_reload_log_level();
|
||||||
virtual int on_reload_log_file();
|
virtual int on_reload_log_file();
|
||||||
|
|
|
@ -40,6 +40,11 @@ int ISrsReloadHandler::on_reload_listen()
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ISrsReloadHandler::on_reload_utc_time()
|
||||||
|
{
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int ISrsReloadHandler::on_reload_max_conns()
|
int ISrsReloadHandler::on_reload_max_conns()
|
||||||
{
|
{
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
ISrsReloadHandler();
|
ISrsReloadHandler();
|
||||||
virtual ~ISrsReloadHandler();
|
virtual ~ISrsReloadHandler();
|
||||||
public:
|
public:
|
||||||
|
virtual int on_reload_utc_time();
|
||||||
virtual int on_reload_max_conns();
|
virtual int on_reload_max_conns();
|
||||||
virtual int on_reload_listen();
|
virtual int on_reload_listen();
|
||||||
virtual int on_reload_pid();
|
virtual int on_reload_pid();
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 185
|
#define VERSION_REVISION 186
|
||||||
|
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "SRS"
|
#define RTMP_SIG_SRS_KEY "SRS"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue