1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

refine network bytes of summaries, remove the lo data.

This commit is contained in:
winlin 2014-06-18 16:21:33 +08:00
parent d0b08d0d51
commit b0e4dc8085
2 changed files with 11 additions and 5 deletions

View file

@ -406,13 +406,18 @@ int SrsApiSummaries::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
int nb_n = srs_get_network_devices_count(); int nb_n = srs_get_network_devices_count();
for (int i = 0; i < nb_n; i++) { for (int i = 0; i < nb_n; i++) {
SrsNetworkDevices& o = n[i]; SrsNetworkDevices& o = n[i];
if (o.ok) {
// ignore the lo interface.
std::string inter = o.name;
if (!o.ok || inter == "lo") {
continue;
}
n_ok = true; n_ok = true;
nr_bytes += o.rbytes; nr_bytes += o.rbytes;
ns_bytes += o.sbytes; ns_bytes += o.sbytes;
n_sample_time = o.sample_time; n_sample_time = o.sample_time;
} }
}
ss << JOBJECT_START ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT

View file

@ -509,6 +509,7 @@ void srs_update_network_devices()
if (ret == 17) { if (ret == 17) {
r.ok = true; r.ok = true;
r.name[sizeof(r.name) - 1] = 0;
_nb_srs_system_network_devices = i + 1; _nb_srs_system_network_devices = i + 1;
r.sample_time = srs_get_system_time_ms(); r.sample_time = srs_get_system_time_ms();
} }