From b0e4dc80856be784729610ca290176b8fdf1b3a9 Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 18 Jun 2014 16:21:33 +0800 Subject: [PATCH] refine network bytes of summaries, remove the lo data. --- trunk/src/app/srs_app_http_api.cpp | 15 ++++++++++----- trunk/src/app/srs_app_utility.cpp | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/trunk/src/app/srs_app_http_api.cpp b/trunk/src/app/srs_app_http_api.cpp index 03c5f998f..f38be42ac 100644 --- a/trunk/src/app/srs_app_http_api.cpp +++ b/trunk/src/app/srs_app_http_api.cpp @@ -406,12 +406,17 @@ int SrsApiSummaries::do_process_request(SrsSocket* skt, SrsHttpMessage* req) int nb_n = srs_get_network_devices_count(); for (int i = 0; i < nb_n; i++) { SrsNetworkDevices& o = n[i]; - if (o.ok) { - n_ok = true; - nr_bytes += o.rbytes; - ns_bytes += o.sbytes; - n_sample_time = o.sample_time; + + // ignore the lo interface. + std::string inter = o.name; + if (!o.ok || inter == "lo") { + continue; } + + n_ok = true; + nr_bytes += o.rbytes; + ns_bytes += o.sbytes; + n_sample_time = o.sample_time; } ss << JOBJECT_START diff --git a/trunk/src/app/srs_app_utility.cpp b/trunk/src/app/srs_app_utility.cpp index e268308e2..023b94d72 100644 --- a/trunk/src/app/srs_app_utility.cpp +++ b/trunk/src/app/srs_app_utility.cpp @@ -509,6 +509,7 @@ void srs_update_network_devices() if (ret == 17) { r.ok = true; + r.name[sizeof(r.name) - 1] = 0; _nb_srs_system_network_devices = i + 1; r.sample_time = srs_get_system_time_ms(); }