diff --git a/lib/bc-stats.cpp b/lib/bc-stats.cpp index db35ae7b..604ade5e 100644 --- a/lib/bc-stats.cpp +++ b/lib/bc-stats.cpp @@ -372,9 +372,7 @@ bool bc_stats::update_net_info() if (iface.pkts_sent > it->second.pkts_sent && it->second.pkts_sent > 0) iface.pkts_sent_per_sec = (iface.pkts_sent - it->second.pkts_sent) / _monitoring_interval; - if (!iface.ipaddr.length()) iface.ipaddr = get_iface_ip_addr(iface.name.c_str()); - - /* Update existing value with copy-assigment */ + iface.ipaddr = get_iface_ip_addr(iface.name.c_str()); it->second = iface; } else diff --git a/lib/bc-stats.h b/lib/bc-stats.h index b1c1dfe5..73a41eba 100644 --- a/lib/bc-stats.h +++ b/lib/bc-stats.h @@ -51,16 +51,16 @@ class bc_stats std::string ipaddr = std::string(""); std::string name = std::string(""); - uint64_t bytes_recv_per_sec; - uint64_t bytes_sent_per_sec; - uint64_t pkts_recv_per_sec; - uint64_t pkts_sent_per_sec; - - int64_t bytes_recv; - int64_t bytes_sent; - int64_t pkts_recv; - int64_t pkts_sent; - int32_t type; + uint64_t bytes_recv_per_sec = 0; + uint64_t bytes_sent_per_sec = 0; + uint64_t pkts_recv_per_sec = 0; + uint64_t pkts_sent_per_sec = 0; + + int64_t bytes_recv = 0; + int64_t bytes_sent = 0; + int64_t pkts_recv = 0; + int64_t pkts_sent = 0; + int32_t type = 0; }; static void copy_cpu_info(bc_stats::cpu_info *dst, bc_stats::cpu_info *src);