正在显示
3 个修改的文件
包含
26 行增加
和
2 行删除
| @@ -44,6 +44,7 @@ using namespace std; | @@ -44,6 +44,7 @@ using namespace std; | ||
| 44 | #include <srs_core_autofree.hpp> | 44 | #include <srs_core_autofree.hpp> |
| 45 | #include <srs_app_source.hpp> | 45 | #include <srs_app_source.hpp> |
| 46 | #include <srs_kernel_file.hpp> | 46 | #include <srs_kernel_file.hpp> |
| 47 | +#include <srs_app_utility.hpp> | ||
| 47 | 48 | ||
| 48 | using namespace _srs_internal; | 49 | using namespace _srs_internal; |
| 49 | 50 | ||
| @@ -1448,6 +1449,30 @@ int SrsConfig::check_config() | @@ -1448,6 +1449,30 @@ int SrsConfig::check_config() | ||
| 1448 | get_stats_network(), ret); | 1449 | get_stats_network(), ret); |
| 1449 | return ret; | 1450 | return ret; |
| 1450 | } | 1451 | } |
| 1452 | + if (true) { | ||
| 1453 | + vector<std::string> ips = srs_get_local_ipv4_ips(); | ||
| 1454 | + int index = get_stats_network(); | ||
| 1455 | + if (index >= (int)ips.size()) { | ||
| 1456 | + ret = ERROR_SYSTEM_CONFIG_INVALID; | ||
| 1457 | + srs_error("stats network invalid, total local ip count=%d, index=%d, ret=%d", | ||
| 1458 | + (int)ips.size(), index, ret); | ||
| 1459 | + return ret; | ||
| 1460 | + } | ||
| 1461 | + srs_warn("stats network use index=%d, ip=%s", index, ips.at(index).c_str()); | ||
| 1462 | + } | ||
| 1463 | + if (true) { | ||
| 1464 | + SrsConfDirective* conf = get_stats_disk_device(); | ||
| 1465 | + if (conf == NULL || (int)conf->args.size() <= 0) { | ||
| 1466 | + srs_warn("stats disk not configed, disk iops disabled."); | ||
| 1467 | + } else { | ||
| 1468 | + string disks; | ||
| 1469 | + for (int i = 0; i < (int)conf->args.size(); i++) { | ||
| 1470 | + disks += conf->args.at(i); | ||
| 1471 | + disks += " "; | ||
| 1472 | + } | ||
| 1473 | + srs_warn("stats disk list: %s", disks.c_str()); | ||
| 1474 | + } | ||
| 1475 | + } | ||
| 1451 | 1476 | ||
| 1452 | //////////////////////////////////////////////////////////////////////// | 1477 | //////////////////////////////////////////////////////////////////////// |
| 1453 | // check http api | 1478 | // check http api |
| @@ -943,7 +943,7 @@ void retrieve_local_ipv4_ips() | @@ -943,7 +943,7 @@ void retrieve_local_ipv4_ips() | ||
| 943 | 943 | ||
| 944 | std::string ip = buf; | 944 | std::string ip = buf; |
| 945 | if (ip != SRS_CONSTS_LOCALHOST) { | 945 | if (ip != SRS_CONSTS_LOCALHOST) { |
| 946 | - srs_trace("retrieve local ipv4 addresses: %s", ip.c_str()); | 946 | + srs_trace("retrieve local ipv4 ip=%s, index=%d", ip.c_str(), (int)ips.size()); |
| 947 | ips.push_back(ip); | 947 | ips.push_back(ip); |
| 948 | } | 948 | } |
| 949 | } | 949 | } |
| @@ -610,7 +610,6 @@ extern SrsNetworkRtmpServer* srs_get_network_rtmp_server(); | @@ -610,7 +610,6 @@ extern SrsNetworkRtmpServer* srs_get_network_rtmp_server(); | ||
| 610 | extern void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps); | 610 | extern void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps); |
| 611 | 611 | ||
| 612 | // get local ip, fill to @param ips | 612 | // get local ip, fill to @param ips |
| 613 | -extern void srs_retrieve_local_ipv4_ips(); | ||
| 614 | extern std::vector<std::string>& srs_get_local_ipv4_ips(); | 613 | extern std::vector<std::string>& srs_get_local_ipv4_ips(); |
| 615 | 614 | ||
| 616 | // get local or peer ip. | 615 | // get local or peer ip. |
-
请 注册 或 登录 后发表评论