正在显示
7 个修改的文件
包含
34 行增加
和
3 行删除
| @@ -341,6 +341,7 @@ Remark: | @@ -341,6 +341,7 @@ Remark: | ||
| 341 | 341 | ||
| 342 | ## History | 342 | ## History |
| 343 | 343 | ||
| 344 | +* v2.0, 2015-09-09, support reload utc_time. 2.0.186 | ||
| 344 | * <strong>v2.0, 2015-08-23, [2.0 alpha(2.0.185)][r2.0a0] released. 89022 lines.</strong> | 345 | * <strong>v2.0, 2015-08-23, [2.0 alpha(2.0.185)][r2.0a0] released. 89022 lines.</strong> |
| 345 | * v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx. | 346 | * v2.0, 2015-08-22, HTTP API support JSONP by specifies the query string callback=xxx. |
| 346 | * v2.0, 2015-08-20, fix [#380][bug #380], srs-librtmp send sequence header when sps or pps changed. | 347 | * 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) | @@ -957,12 +957,24 @@ int SrsConfig::reload_conf(SrsConfig* conf) | ||
| 957 | srs_trace("reload srs_log_file success."); | 957 | srs_trace("reload srs_log_file success."); |
| 958 | } | 958 | } |
| 959 | 959 | ||
| 960 | + // merge config: utc_time | ||
| 961 | + if (!srs_directive_equals(root->get("utc_time"), old_root->get("utc_time"))) { | ||
| 962 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 963 | + ISrsReloadHandler* subscribe = *it; | ||
| 964 | + if ((ret = subscribe->on_reload_utc_time()) != ERROR_SUCCESS) { | ||
| 965 | + srs_error("notify subscribes reload utc_time failed. ret=%d", ret); | ||
| 966 | + return ret; | ||
| 967 | + } | ||
| 968 | + } | ||
| 969 | + srs_trace("reload utc_time success."); | ||
| 970 | + } | ||
| 971 | + | ||
| 960 | // merge config: pithy_print_ms | 972 | // merge config: pithy_print_ms |
| 961 | if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) { | 973 | if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) { |
| 962 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { | 974 | for (it = subscribes.begin(); it != subscribes.end(); ++it) { |
| 963 | ISrsReloadHandler* subscribe = *it; | 975 | ISrsReloadHandler* subscribe = *it; |
| 964 | if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) { | 976 | if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) { |
| 965 | - srs_error("notify subscribes pithy_print_ms listen failed. ret=%d", ret); | 977 | + srs_error("notify subscribes pithy_print_ms failed. ret=%d", ret); |
| 966 | return ret; | 978 | return ret; |
| 967 | } | 979 | } |
| 968 | } | 980 | } |
| @@ -86,6 +86,7 @@ SrsFastLog::SrsFastLog() | @@ -86,6 +86,7 @@ SrsFastLog::SrsFastLog() | ||
| 86 | 86 | ||
| 87 | fd = -1; | 87 | fd = -1; |
| 88 | log_to_file_tank = false; | 88 | log_to_file_tank = false; |
| 89 | + utc = false; | ||
| 89 | } | 90 | } |
| 90 | 91 | ||
| 91 | SrsFastLog::~SrsFastLog() | 92 | SrsFastLog::~SrsFastLog() |
| @@ -111,6 +112,7 @@ int SrsFastLog::initialize() | @@ -111,6 +112,7 @@ int SrsFastLog::initialize() | ||
| 111 | 112 | ||
| 112 | log_to_file_tank = _srs_config->get_log_tank_file(); | 113 | log_to_file_tank = _srs_config->get_log_tank_file(); |
| 113 | _level = srs_get_log_level(_srs_config->get_log_level()); | 114 | _level = srs_get_log_level(_srs_config->get_log_level()); |
| 115 | + utc = _srs_config->get_utc_time(); | ||
| 114 | } | 116 | } |
| 115 | 117 | ||
| 116 | return ret; | 118 | return ret; |
| @@ -221,6 +223,13 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...) | @@ -221,6 +223,13 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...) | ||
| 221 | write_log(fd, log_data, size, SrsLogLevel::Error); | 223 | write_log(fd, log_data, size, SrsLogLevel::Error); |
| 222 | } | 224 | } |
| 223 | 225 | ||
| 226 | +int SrsFastLog::on_reload_utc_time() | ||
| 227 | +{ | ||
| 228 | + utc = _srs_config->get_utc_time(); | ||
| 229 | + | ||
| 230 | + return ERROR_SUCCESS; | ||
| 231 | +} | ||
| 232 | + | ||
| 224 | int SrsFastLog::on_reload_log_tank() | 233 | int SrsFastLog::on_reload_log_tank() |
| 225 | { | 234 | { |
| 226 | int ret = ERROR_SUCCESS; | 235 | int ret = ERROR_SUCCESS; |
| @@ -291,7 +300,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co | @@ -291,7 +300,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co | ||
| 291 | 300 | ||
| 292 | // to calendar time | 301 | // to calendar time |
| 293 | struct tm* tm; | 302 | struct tm* tm; |
| 294 | - if (_srs_config && _srs_config->get_utc_time()) { | 303 | + if (utc) { |
| 295 | if ((tm = gmtime(&tv.tv_sec)) == NULL) { | 304 | if ((tm = gmtime(&tv.tv_sec)) == NULL) { |
| 296 | return false; | 305 | return false; |
| 297 | } | 306 | } |
| @@ -73,6 +73,8 @@ private: | @@ -73,6 +73,8 @@ private: | ||
| 73 | int fd; | 73 | int fd; |
| 74 | // whether log to file tank | 74 | // whether log to file tank |
| 75 | bool log_to_file_tank; | 75 | bool log_to_file_tank; |
| 76 | + // whether use utc time. | ||
| 77 | + bool utc; | ||
| 76 | public: | 78 | public: |
| 77 | SrsFastLog(); | 79 | SrsFastLog(); |
| 78 | virtual ~SrsFastLog(); | 80 | virtual ~SrsFastLog(); |
| @@ -85,6 +87,7 @@ public: | @@ -85,6 +87,7 @@ public: | ||
| 85 | virtual void error(const char* tag, int context_id, const char* fmt, ...); | 87 | virtual void error(const char* tag, int context_id, const char* fmt, ...); |
| 86 | // interface ISrsReloadHandler. | 88 | // interface ISrsReloadHandler. |
| 87 | public: | 89 | public: |
| 90 | + virtual int on_reload_utc_time(); | ||
| 88 | virtual int on_reload_log_tank(); | 91 | virtual int on_reload_log_tank(); |
| 89 | virtual int on_reload_log_level(); | 92 | virtual int on_reload_log_level(); |
| 90 | virtual int on_reload_log_file(); | 93 | virtual int on_reload_log_file(); |
| @@ -40,6 +40,11 @@ int ISrsReloadHandler::on_reload_listen() | @@ -40,6 +40,11 @@ int ISrsReloadHandler::on_reload_listen() | ||
| 40 | return ERROR_SUCCESS; | 40 | return ERROR_SUCCESS; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | +int ISrsReloadHandler::on_reload_utc_time() | ||
| 44 | +{ | ||
| 45 | + return ERROR_SUCCESS; | ||
| 46 | +} | ||
| 47 | + | ||
| 43 | int ISrsReloadHandler::on_reload_max_conns() | 48 | int ISrsReloadHandler::on_reload_max_conns() |
| 44 | { | 49 | { |
| 45 | return ERROR_SUCCESS; | 50 | return ERROR_SUCCESS; |
| @@ -44,6 +44,7 @@ public: | @@ -44,6 +44,7 @@ public: | ||
| 44 | ISrsReloadHandler(); | 44 | ISrsReloadHandler(); |
| 45 | virtual ~ISrsReloadHandler(); | 45 | virtual ~ISrsReloadHandler(); |
| 46 | public: | 46 | public: |
| 47 | + virtual int on_reload_utc_time(); | ||
| 47 | virtual int on_reload_max_conns(); | 48 | virtual int on_reload_max_conns(); |
| 48 | virtual int on_reload_listen(); | 49 | virtual int on_reload_listen(); |
| 49 | virtual int on_reload_pid(); | 50 | virtual int on_reload_pid(); |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR 2 | 32 | #define VERSION_MAJOR 2 |
| 33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
| 34 | -#define VERSION_REVISION 185 | 34 | +#define VERSION_REVISION 186 |
| 35 | 35 | ||
| 36 | // server info. | 36 | // server info. |
| 37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
-
请 注册 或 登录 后发表评论