Fix host pools traffic stats reset after reloadPools

This commit is contained in:
Emanuele Faranda 2017-11-04 23:35:11 +01:00
parent 7369ddf780
commit ce4e5677c6
2 changed files with 16 additions and 4 deletions

View file

@ -23,6 +23,7 @@
/* *************************************** */
/* NOTE: keep in sync with copy constructor below */
GenericTrafficElement::GenericTrafficElement() {
ndpiStats = NULL;
last_bytes = 0, last_bytes_thpt = bytes_thpt = 0, bytes_thpt_trend = trend_unknown;
@ -36,6 +37,20 @@ GenericTrafficElement::GenericTrafficElement() {
/* *************************************** */
GenericTrafficElement::GenericTrafficElement(const GenericTrafficElement &gte) {
ndpiStats = (gte.ndpiStats) ? new nDPIStats(*gte.ndpiStats) : NULL;
sent = gte.sent, rcvd = gte.rcvd;
last_bytes = gte.last_bytes, bytes_thpt = gte.bytes_thpt, last_bytes_thpt = gte.last_bytes_thpt, bytes_thpt_trend = gte.bytes_thpt_trend;
bytes_thpt_diff = gte.bytes_thpt_diff;
last_packets = gte.last_packets, pkts_thpt = gte.pkts_thpt, last_pkts_thpt = gte.last_pkts_thpt, pkts_thpt_trend = gte.pkts_thpt_trend;
last_update_time = gte.last_update_time;
vlan_id = gte.vlan_id;
total_num_dropped_flows = gte.total_num_dropped_flows;
}
/* *************************************** */
void GenericTrafficElement::updateStats(struct timeval *tv) {
if(last_update_time.tv_sec > 0) {
float tdiff = Utils::msTimevalDiff(tv, &last_update_time);