Skip to content

Commit

Permalink
support reload utc_time. 2.0.186
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Sep 9, 2015
1 parent 0221434 commit abd7ee2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ Remark:

## 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>
* 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.
Expand Down
14 changes: 13 additions & 1 deletion trunk/src/app/srs_app_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,12 +957,24 @@ int SrsConfig::reload_conf(SrsConfig* conf)
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
if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) {
for (it = subscribes.begin(); it != subscribes.end(); ++it) {
ISrsReloadHandler* subscribe = *it;
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;
}
}
Expand Down
11 changes: 10 additions & 1 deletion trunk/src/app/srs_app_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ SrsFastLog::SrsFastLog()

fd = -1;
log_to_file_tank = false;
utc = false;
}

SrsFastLog::~SrsFastLog()
Expand All @@ -111,6 +112,7 @@ int SrsFastLog::initialize()

log_to_file_tank = _srs_config->get_log_tank_file();
_level = srs_get_log_level(_srs_config->get_log_level());
utc = _srs_config->get_utc_time();
}

return ret;
Expand Down Expand Up @@ -221,6 +223,13 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...)
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 ret = ERROR_SUCCESS;
Expand Down Expand Up @@ -291,7 +300,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co

// to calendar time
struct tm* tm;
if (_srs_config && _srs_config->get_utc_time()) {
if (utc) {
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions trunk/src/app/srs_app_log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class SrsFastLog : public ISrsLog, public ISrsReloadHandler
int fd;
// whether log to file tank
bool log_to_file_tank;
// whether use utc time.
bool utc;
public:
SrsFastLog();
virtual ~SrsFastLog();
Expand All @@ -85,6 +87,7 @@ class SrsFastLog : public ISrsLog, public ISrsReloadHandler
virtual void error(const char* tag, int context_id, const char* fmt, ...);
// interface ISrsReloadHandler.
public:
virtual int on_reload_utc_time();
virtual int on_reload_log_tank();
virtual int on_reload_log_level();
virtual int on_reload_log_file();
Expand Down
5 changes: 5 additions & 0 deletions trunk/src/app/srs_app_reload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ int ISrsReloadHandler::on_reload_listen()
return ERROR_SUCCESS;
}

int ISrsReloadHandler::on_reload_utc_time()
{
return ERROR_SUCCESS;
}

int ISrsReloadHandler::on_reload_max_conns()
{
return ERROR_SUCCESS;
Expand Down
1 change: 1 addition & 0 deletions trunk/src/app/srs_app_reload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ISrsReloadHandler
ISrsReloadHandler();
virtual ~ISrsReloadHandler();
public:
virtual int on_reload_utc_time();
virtual int on_reload_max_conns();
virtual int on_reload_listen();
virtual int on_reload_pid();
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 185
#define VERSION_REVISION 186

// server info.
#define RTMP_SIG_SRS_KEY "SRS"
Expand Down

0 comments on commit abd7ee2

Please sign in to comment.