diff --git a/include/GenericTrafficElement.h b/include/GenericTrafficElement.h index afd725b846..11cbb79b5a 100644 --- a/include/GenericTrafficElement.h +++ b/include/GenericTrafficElement.h @@ -42,10 +42,7 @@ class GenericTrafficElement { public: GenericTrafficElement(); - - GenericTrafficElement(const GenericTrafficElement >e) { - ndpiStats = (gte.ndpiStats) ? new nDPIStats(*gte.ndpiStats) : NULL; - }; + GenericTrafficElement(const GenericTrafficElement >e); virtual ~GenericTrafficElement() { if(ndpiStats) delete ndpiStats; diff --git a/src/GenericTrafficElement.cpp b/src/GenericTrafficElement.cpp index 8ac5bbc750..5f59f1b9b8 100644 --- a/src/GenericTrafficElement.cpp +++ b/src/GenericTrafficElement.cpp @@ -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 >e) { + 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);