正在显示
9 个修改的文件
包含
236 行增加
和
21 行删除
| @@ -922,18 +922,6 @@ int SrsConfig::reload_conf(SrsConfig* conf) | @@ -922,18 +922,6 @@ int SrsConfig::reload_conf(SrsConfig* conf) | ||
| 922 | // chunk_size, ff_log_dir, | 922 | // chunk_size, ff_log_dir, |
| 923 | // bandcheck, http_hooks, heartbeat, | 923 | // bandcheck, http_hooks, heartbeat, |
| 924 | // security | 924 | // security |
| 925 | - | ||
| 926 | - // merge config: max_connections | ||
| 927 | - if (!srs_directive_equals(root->get("max_connections"), old_root->get("max_connections"))) { | ||
| 928 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 929 | - ISrsReloadHandler* subscribe = *it; | ||
| 930 | - if ((ret = subscribe->on_reload_max_conns()) != ERROR_SUCCESS) { | ||
| 931 | - srs_error("notify subscribes reload max_connections failed. ret=%d", ret); | ||
| 932 | - return ret; | ||
| 933 | - } | ||
| 934 | - } | ||
| 935 | - srs_trace("reload max_connections success."); | ||
| 936 | - } | ||
| 937 | 925 | ||
| 938 | // merge config: listen | 926 | // merge config: listen |
| 939 | if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { | 927 | if (!srs_directive_equals(root->get("listen"), old_root->get("listen"))) { |
| @@ -970,16 +958,25 @@ int SrsConfig::reload_conf(SrsConfig* conf) | @@ -970,16 +958,25 @@ int SrsConfig::reload_conf(SrsConfig* conf) | ||
| 970 | } | 958 | } |
| 971 | } | 959 | } |
| 972 | 960 | ||
| 961 | + // merge config: max_connections | ||
| 962 | + if (!srs_directive_equals(root->get("max_connections"), old_root->get("max_connections"))) { | ||
| 963 | + if ((ret = do_reload_max_connections()) != ERROR_SUCCESS) { | ||
| 964 | + return ret; | ||
| 965 | + } | ||
| 966 | + } | ||
| 967 | + | ||
| 968 | + // merge config: utc_time | ||
| 969 | + if (!srs_directive_equals(root->get("utc_time"), old_root->get("utc_time"))) { | ||
| 970 | + if ((ret = do_reload_utc_time()) != ERROR_SUCCESS) { | ||
| 971 | + return ret; | ||
| 972 | + } | ||
| 973 | + } | ||
| 974 | + | ||
| 973 | // merge config: pithy_print_ms | 975 | // merge config: pithy_print_ms |
| 974 | if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) { | 976 | if (!srs_directive_equals(root->get("pithy_print_ms"), old_root->get("pithy_print_ms"))) { |
| 975 | - for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 976 | - ISrsReloadHandler* subscribe = *it; | ||
| 977 | - if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) { | ||
| 978 | - srs_error("notify subscribes pithy_print_ms listen failed. ret=%d", ret); | ||
| 979 | - return ret; | ||
| 980 | - } | 977 | + if ((ret = do_reload_pithy_print_ms()) != ERROR_SUCCESS) { |
| 978 | + return ret; | ||
| 981 | } | 979 | } |
| 982 | - srs_trace("reload pithy_print_ms success."); | ||
| 983 | } | 980 | } |
| 984 | 981 | ||
| 985 | // merge config: http_api | 982 | // merge config: http_api |
| @@ -2376,6 +2373,81 @@ int SrsConfig::raw_set_srs_log_file(string srs_log_file, bool& applied) | @@ -2376,6 +2373,81 @@ int SrsConfig::raw_set_srs_log_file(string srs_log_file, bool& applied) | ||
| 2376 | return ret; | 2373 | return ret; |
| 2377 | } | 2374 | } |
| 2378 | 2375 | ||
| 2376 | +int SrsConfig::raw_set_max_connections(string max_connections, bool& applied) | ||
| 2377 | +{ | ||
| 2378 | + int ret = ERROR_SUCCESS; | ||
| 2379 | + | ||
| 2380 | + applied = false; | ||
| 2381 | + | ||
| 2382 | + | ||
| 2383 | + SrsConfDirective* conf = root->get_or_create("max_connections"); | ||
| 2384 | + | ||
| 2385 | + if (conf->arg0() == max_connections) { | ||
| 2386 | + return ret; | ||
| 2387 | + } | ||
| 2388 | + | ||
| 2389 | + conf->args.clear(); | ||
| 2390 | + conf->args.push_back(max_connections); | ||
| 2391 | + | ||
| 2392 | + if ((ret = do_reload_max_connections()) != ERROR_SUCCESS) { | ||
| 2393 | + return ret; | ||
| 2394 | + } | ||
| 2395 | + | ||
| 2396 | + applied = true; | ||
| 2397 | + | ||
| 2398 | + return ret; | ||
| 2399 | +} | ||
| 2400 | + | ||
| 2401 | +int SrsConfig::raw_set_utc_time(string utc_time, bool& applied) | ||
| 2402 | +{ | ||
| 2403 | + int ret = ERROR_SUCCESS; | ||
| 2404 | + | ||
| 2405 | + applied = false; | ||
| 2406 | + | ||
| 2407 | + | ||
| 2408 | + SrsConfDirective* conf = root->get_or_create("utc_time"); | ||
| 2409 | + | ||
| 2410 | + if (conf->arg0() == utc_time) { | ||
| 2411 | + return ret; | ||
| 2412 | + } | ||
| 2413 | + | ||
| 2414 | + conf->args.clear(); | ||
| 2415 | + conf->args.push_back(utc_time); | ||
| 2416 | + | ||
| 2417 | + if ((ret = do_reload_utc_time()) != ERROR_SUCCESS) { | ||
| 2418 | + return ret; | ||
| 2419 | + } | ||
| 2420 | + | ||
| 2421 | + applied = true; | ||
| 2422 | + | ||
| 2423 | + return ret; | ||
| 2424 | +} | ||
| 2425 | + | ||
| 2426 | +int SrsConfig::raw_set_pithy_print_ms(string pithy_print_ms, bool& applied) | ||
| 2427 | +{ | ||
| 2428 | + int ret = ERROR_SUCCESS; | ||
| 2429 | + | ||
| 2430 | + applied = false; | ||
| 2431 | + | ||
| 2432 | + | ||
| 2433 | + SrsConfDirective* conf = root->get_or_create("pithy_print_ms"); | ||
| 2434 | + | ||
| 2435 | + if (conf->arg0() == pithy_print_ms) { | ||
| 2436 | + return ret; | ||
| 2437 | + } | ||
| 2438 | + | ||
| 2439 | + conf->args.clear(); | ||
| 2440 | + conf->args.push_back(pithy_print_ms); | ||
| 2441 | + | ||
| 2442 | + if ((ret = do_reload_pithy_print_ms()) != ERROR_SUCCESS) { | ||
| 2443 | + return ret; | ||
| 2444 | + } | ||
| 2445 | + | ||
| 2446 | + applied = true; | ||
| 2447 | + | ||
| 2448 | + return ret; | ||
| 2449 | +} | ||
| 2450 | + | ||
| 2379 | int SrsConfig::do_reload_listen() | 2451 | int SrsConfig::do_reload_listen() |
| 2380 | { | 2452 | { |
| 2381 | int ret = ERROR_SUCCESS; | 2453 | int ret = ERROR_SUCCESS; |
| @@ -2461,6 +2533,57 @@ int SrsConfig::do_reload_srs_log_file() | @@ -2461,6 +2533,57 @@ int SrsConfig::do_reload_srs_log_file() | ||
| 2461 | return ret; | 2533 | return ret; |
| 2462 | } | 2534 | } |
| 2463 | 2535 | ||
| 2536 | +int SrsConfig::do_reload_max_connections() | ||
| 2537 | +{ | ||
| 2538 | + int ret = ERROR_SUCCESS; | ||
| 2539 | + | ||
| 2540 | + vector<ISrsReloadHandler*>::iterator it; | ||
| 2541 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 2542 | + ISrsReloadHandler* subscribe = *it; | ||
| 2543 | + if ((ret = subscribe->on_reload_max_conns()) != ERROR_SUCCESS) { | ||
| 2544 | + srs_error("notify subscribes reload max_connections failed. ret=%d", ret); | ||
| 2545 | + return ret; | ||
| 2546 | + } | ||
| 2547 | + } | ||
| 2548 | + srs_trace("reload max_connections success."); | ||
| 2549 | + | ||
| 2550 | + return ret; | ||
| 2551 | +} | ||
| 2552 | + | ||
| 2553 | +int SrsConfig::do_reload_utc_time() | ||
| 2554 | +{ | ||
| 2555 | + int ret = ERROR_SUCCESS; | ||
| 2556 | + | ||
| 2557 | + vector<ISrsReloadHandler*>::iterator it; | ||
| 2558 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 2559 | + ISrsReloadHandler* subscribe = *it; | ||
| 2560 | + if ((ret = subscribe->on_reload_utc_time()) != ERROR_SUCCESS) { | ||
| 2561 | + srs_error("notify subscribes utc_time failed. ret=%d", ret); | ||
| 2562 | + return ret; | ||
| 2563 | + } | ||
| 2564 | + } | ||
| 2565 | + srs_trace("reload utc_time success."); | ||
| 2566 | + | ||
| 2567 | + return ret; | ||
| 2568 | +} | ||
| 2569 | + | ||
| 2570 | +int SrsConfig::do_reload_pithy_print_ms() | ||
| 2571 | +{ | ||
| 2572 | + int ret = ERROR_SUCCESS; | ||
| 2573 | + | ||
| 2574 | + vector<ISrsReloadHandler*>::iterator it; | ||
| 2575 | + for (it = subscribes.begin(); it != subscribes.end(); ++it) { | ||
| 2576 | + ISrsReloadHandler* subscribe = *it; | ||
| 2577 | + if ((ret = subscribe->on_reload_pithy_print()) != ERROR_SUCCESS) { | ||
| 2578 | + srs_error("notify subscribes pithy_print_ms failed. ret=%d", ret); | ||
| 2579 | + return ret; | ||
| 2580 | + } | ||
| 2581 | + } | ||
| 2582 | + srs_trace("reload pithy_print_ms success."); | ||
| 2583 | + | ||
| 2584 | + return ret; | ||
| 2585 | +} | ||
| 2586 | + | ||
| 2464 | string SrsConfig::config() | 2587 | string SrsConfig::config() |
| 2465 | { | 2588 | { |
| 2466 | return config_file; | 2589 | return config_file; |
| @@ -5989,6 +6112,11 @@ bool srs_stream_caster_is_flv(string caster) | @@ -5989,6 +6112,11 @@ bool srs_stream_caster_is_flv(string caster) | ||
| 5989 | return caster == "flv"; | 6112 | return caster == "flv"; |
| 5990 | } | 6113 | } |
| 5991 | 6114 | ||
| 6115 | +string srs_config_bool2switch(const string& sbool) | ||
| 6116 | +{ | ||
| 6117 | + return sbool == "true"? "on":"off"; | ||
| 6118 | +} | ||
| 6119 | + | ||
| 5992 | int srs_config_transform_vhost(SrsConfDirective* root) | 6120 | int srs_config_transform_vhost(SrsConfDirective* root) |
| 5993 | { | 6121 | { |
| 5994 | int ret = ERROR_SUCCESS; | 6122 | int ret = ERROR_SUCCESS; |
| @@ -361,12 +361,27 @@ public: | @@ -361,12 +361,27 @@ public: | ||
| 361 | * raw set the global log file path for file tank. | 361 | * raw set the global log file path for file tank. |
| 362 | */ | 362 | */ |
| 363 | virtual int raw_set_srs_log_file(std::string srs_log_file, bool& applied); | 363 | virtual int raw_set_srs_log_file(std::string srs_log_file, bool& applied); |
| 364 | + /** | ||
| 365 | + * raw set the global max connections of srs. | ||
| 366 | + */ | ||
| 367 | + virtual int raw_set_max_connections(std::string max_connections, bool& applied); | ||
| 368 | + /** | ||
| 369 | + * raw set the global whether use utc time. | ||
| 370 | + */ | ||
| 371 | + virtual int raw_set_utc_time(std::string utc_time, bool& applied); | ||
| 372 | + /** | ||
| 373 | + * raw set the global pithy print interval in ms. | ||
| 374 | + */ | ||
| 375 | + virtual int raw_set_pithy_print_ms(std::string pithy_print_ms, bool& applied); | ||
| 364 | private: | 376 | private: |
| 365 | virtual int do_reload_listen(); | 377 | virtual int do_reload_listen(); |
| 366 | virtual int do_reload_pid(); | 378 | virtual int do_reload_pid(); |
| 367 | virtual int do_reload_srs_log_tank(); | 379 | virtual int do_reload_srs_log_tank(); |
| 368 | virtual int do_reload_srs_log_level(); | 380 | virtual int do_reload_srs_log_level(); |
| 369 | virtual int do_reload_srs_log_file(); | 381 | virtual int do_reload_srs_log_file(); |
| 382 | + virtual int do_reload_max_connections(); | ||
| 383 | + virtual int do_reload_utc_time(); | ||
| 384 | + virtual int do_reload_pithy_print_ms(); | ||
| 370 | public: | 385 | public: |
| 371 | /** | 386 | /** |
| 372 | * get the config file path. | 387 | * get the config file path. |
| @@ -1279,6 +1294,11 @@ extern bool srs_stream_caster_is_rtsp(std::string caster); | @@ -1279,6 +1294,11 @@ extern bool srs_stream_caster_is_rtsp(std::string caster); | ||
| 1279 | extern bool srs_stream_caster_is_flv(std::string caster); | 1294 | extern bool srs_stream_caster_is_flv(std::string caster); |
| 1280 | 1295 | ||
| 1281 | /** | 1296 | /** |
| 1297 | + * convert bool in str to on/off | ||
| 1298 | + */ | ||
| 1299 | +extern std::string srs_config_bool2switch(const std::string& sbool); | ||
| 1300 | + | ||
| 1301 | +/** | ||
| 1282 | * parse loaded vhost directives to compatible mode. | 1302 | * parse loaded vhost directives to compatible mode. |
| 1283 | * for exmaple, SRS1/2 use the follow refer style: | 1303 | * for exmaple, SRS1/2 use the follow refer style: |
| 1284 | * refer a.domain.com b.domain.com; | 1304 | * refer a.domain.com b.domain.com; |
| @@ -993,6 +993,9 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -993,6 +993,9 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 993 | // srs_log_tank file the tank to log, file or console. | 993 | // srs_log_tank file the tank to log, file or console. |
| 994 | // srs_log_level trace the level of log, verbose, info, trace, warn, error. | 994 | // srs_log_level trace the level of log, verbose, info, trace, warn, error. |
| 995 | // srs_log_file ./objs/srs.log the log file when tank is file. | 995 | // srs_log_file ./objs/srs.log the log file when tank is file. |
| 996 | + // max_connections 1000 the max connections of srs. | ||
| 997 | + // utc_time false whether enable utc time. | ||
| 998 | + // pithy_print_ms 10000 the pithy print interval in ms. | ||
| 996 | if (rpc == "update") { | 999 | if (rpc == "update") { |
| 997 | if (!allow_update) { | 1000 | if (!allow_update) { |
| 998 | ret = ERROR_SYSTEM_CONFIG_RAW_DISABLED; | 1001 | ret = ERROR_SYSTEM_CONFIG_RAW_DISABLED; |
| @@ -1009,7 +1012,8 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -1009,7 +1012,8 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 1009 | } | 1012 | } |
| 1010 | if (scope != "listen" && scope != "pid" && scope != "chunk_size" | 1013 | if (scope != "listen" && scope != "pid" && scope != "chunk_size" |
| 1011 | && scope != "ff_log_dir" && scope != "srs_log_tank" && scope != "srs_log_level" | 1014 | && scope != "ff_log_dir" && scope != "srs_log_tank" && scope != "srs_log_level" |
| 1012 | - && scope != "srs_log_file" | 1015 | + && scope != "srs_log_file" && scope != "max_connections" && scope != "utc_time" |
| 1016 | + && scope != "pithy_print_ms" | ||
| 1013 | ) { | 1017 | ) { |
| 1014 | ret = ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED; | 1018 | ret = ERROR_SYSTEM_CONFIG_RAW_NOT_ALLOWED; |
| 1015 | srs_error("raw api query invalid scope=%s. ret=%d", scope.c_str(), ret); | 1019 | srs_error("raw api query invalid scope=%s. ret=%d", scope.c_str(), ret); |
| @@ -1106,6 +1110,41 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -1106,6 +1110,41 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 1106 | srs_error("raw api update srs_log_file=%s failed. ret=%d", value.c_str(), ret); | 1110 | srs_error("raw api update srs_log_file=%s failed. ret=%d", value.c_str(), ret); |
| 1107 | return srs_api_response_code(w, r, ret); | 1111 | return srs_api_response_code(w, r, ret); |
| 1108 | } | 1112 | } |
| 1113 | + } else if (scope == "max_connections") { | ||
| 1114 | + int mcv = ::atoi(value.c_str()); | ||
| 1115 | + if (mcv < 10 || mcv > 65535 || !srs_is_digit_number(value)) { | ||
| 1116 | + ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | ||
| 1117 | + srs_error("raw api update check max_connections=%s/%d failed. ret=%d", value.c_str(), mcv, ret); | ||
| 1118 | + return srs_api_response_code(w, r, ret); | ||
| 1119 | + } | ||
| 1120 | + | ||
| 1121 | + if ((ret = _srs_config->raw_set_max_connections(value, applied)) != ERROR_SUCCESS) { | ||
| 1122 | + srs_error("raw api update max_connections=%s/%d failed. ret=%d", value.c_str(), mcv, ret); | ||
| 1123 | + return srs_api_response_code(w, r, ret); | ||
| 1124 | + } | ||
| 1125 | + } else if (scope == "utc_time") { | ||
| 1126 | + if (!srs_is_boolean(value)) { | ||
| 1127 | + ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | ||
| 1128 | + srs_error("raw api update check utc_time=%s failed. ret=%d", value.c_str(), ret); | ||
| 1129 | + return srs_api_response_code(w, r, ret); | ||
| 1130 | + } | ||
| 1131 | + | ||
| 1132 | + if ((ret = _srs_config->raw_set_utc_time(srs_config_bool2switch(value), applied)) != ERROR_SUCCESS) { | ||
| 1133 | + srs_error("raw api update utc_time=%s failed. ret=%d", value.c_str(), ret); | ||
| 1134 | + return srs_api_response_code(w, r, ret); | ||
| 1135 | + } | ||
| 1136 | + } else if (scope == "pithy_print_ms") { | ||
| 1137 | + int ppmv = ::atoi(value.c_str()); | ||
| 1138 | + if (ppmv < 100 || ppmv > 300000 || !srs_is_digit_number(value)) { | ||
| 1139 | + ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | ||
| 1140 | + srs_error("raw api update check pithy_print_ms=%s/%d failed. ret=%d", value.c_str(), ppmv, ret); | ||
| 1141 | + return srs_api_response_code(w, r, ret); | ||
| 1142 | + } | ||
| 1143 | + | ||
| 1144 | + if ((ret = _srs_config->raw_set_pithy_print_ms(value, applied)) != ERROR_SUCCESS) { | ||
| 1145 | + srs_error("raw api update pithy_print_ms=%s/%d failed. ret=%d", value.c_str(), ppmv, ret); | ||
| 1146 | + return srs_api_response_code(w, r, ret); | ||
| 1147 | + } | ||
| 1109 | } | 1148 | } |
| 1110 | 1149 | ||
| 1111 | // whether the config applied. | 1150 | // whether the config applied. |
| @@ -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(); |
| @@ -45,6 +45,11 @@ int ISrsReloadHandler::on_reload_max_conns() | @@ -45,6 +45,11 @@ int ISrsReloadHandler::on_reload_max_conns() | ||
| 45 | return ERROR_SUCCESS; | 45 | return ERROR_SUCCESS; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | +int ISrsReloadHandler::on_reload_utc_time() | ||
| 49 | +{ | ||
| 50 | + return ERROR_SUCCESS; | ||
| 51 | +} | ||
| 52 | + | ||
| 48 | int ISrsReloadHandler::on_reload_pid() | 53 | int ISrsReloadHandler::on_reload_pid() |
| 49 | { | 54 | { |
| 50 | return ERROR_SUCCESS; | 55 | return ERROR_SUCCESS; |
| @@ -45,6 +45,7 @@ public: | @@ -45,6 +45,7 @@ public: | ||
| 45 | virtual ~ISrsReloadHandler(); | 45 | virtual ~ISrsReloadHandler(); |
| 46 | public: | 46 | public: |
| 47 | virtual int on_reload_max_conns(); | 47 | virtual int on_reload_max_conns(); |
| 48 | + virtual int on_reload_utc_time(); | ||
| 48 | virtual int on_reload_listen(); | 49 | virtual int on_reload_listen(); |
| 49 | virtual int on_reload_pid(); | 50 | virtual int on_reload_pid(); |
| 50 | virtual int on_reload_log_tank(); | 51 | virtual int on_reload_log_tank(); |
| @@ -1367,6 +1367,11 @@ bool srs_is_digit_number(const string& str) | @@ -1367,6 +1367,11 @@ bool srs_is_digit_number(const string& str) | ||
| 1367 | return v / powv >= 1 && v / powv <= 9; | 1367 | return v / powv >= 1 && v / powv <= 9; |
| 1368 | } | 1368 | } |
| 1369 | 1369 | ||
| 1370 | +bool srs_is_boolean(const string& str) | ||
| 1371 | +{ | ||
| 1372 | + return str == "true" || str == "false"; | ||
| 1373 | +} | ||
| 1374 | + | ||
| 1370 | void srs_api_dump_summaries(SrsAmf0Object* obj) | 1375 | void srs_api_dump_summaries(SrsAmf0Object* obj) |
| 1371 | { | 1376 | { |
| 1372 | SrsRusage* r = srs_get_system_rusage(); | 1377 | SrsRusage* r = srs_get_system_rusage(); |
| @@ -675,6 +675,11 @@ extern std::string srs_get_peer_ip(int fd); | @@ -675,6 +675,11 @@ extern std::string srs_get_peer_ip(int fd); | ||
| 675 | // is_digit("1234567890a") === false | 675 | // is_digit("1234567890a") === false |
| 676 | // is_digit("a1234567890") === false | 676 | // is_digit("a1234567890") === false |
| 677 | extern bool srs_is_digit_number(const std::string& str); | 677 | extern bool srs_is_digit_number(const std::string& str); |
| 678 | +// whether string is boolean | ||
| 679 | +// is_bool("true") == true | ||
| 680 | +// is_bool("false") == true | ||
| 681 | +// otherwise, false. | ||
| 682 | +extern bool srs_is_boolean(const std::string& str); | ||
| 678 | 683 | ||
| 679 | // dump summaries for /api/v1/summaries. | 684 | // dump summaries for /api/v1/summaries. |
| 680 | extern void srs_api_dump_summaries(SrsAmf0Object* obj); | 685 | extern void srs_api_dump_summaries(SrsAmf0Object* obj); |
-
请 注册 或 登录 后发表评论