diff --git a/include/NetworkInterface.h b/include/NetworkInterface.h index 2b334805e9..80fa3631e3 100644 --- a/include/NetworkInterface.h +++ b/include/NetworkInterface.h @@ -250,15 +250,14 @@ protected: hostAlertsDequeueLoopCreated; bool has_too_many_hosts, has_too_many_flows, mtuWarningShown; bool flow_dump_disabled_by_user, flow_dump_disabled_by_backend; - u_int32_t ifSpeed, numL2Devices, totalNumHosts, - numTotalRxOnlyHosts /* subset of numTotalRxOnlyHosts that have received + u_int32_t ifSpeed, scalingFactor; + u_int32_t numL2Devices; + std::atomic totalNumHosts; + std::atomic numTotalRxOnlyHosts; /* subset of numTotalRxOnlyHosts that have received but never sent any traffic */ - , - numLocalHosts, - numLocalRxOnlyHosts /* subset of numLocalHosts that have received but + std::atomic numLocalHosts; + std::atomic numLocalRxOnlyHosts; /* subset of numLocalHosts that have received but never sent any traffic */ - , - scalingFactor; /* Those will hold counters at checkpoints */ u_int64_t checkpointPktCount, checkpointBytesCount, checkpointPktDropCount, checkpointDroppedAlertsCount; diff --git a/src/HostStats.cpp b/src/HostStats.cpp index 8cc59ec159..3b9d027b50 100644 --- a/src/HostStats.cpp +++ b/src/HostStats.cpp @@ -438,7 +438,7 @@ void HostStats::incStats(time_t when, u_int8_t l4_proto, u_int ndpi_proto, sent_bytes); if (host->isRxOnlyHost() && !isReceiveOnly()) /* no longer RX-only */ - host->toggleRxOnlyHost(false); + host->toggleRxOnlyHost(false); } #ifdef NTOPNG_PRO diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index 9ae123dd95..90cdab6d86 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -11140,7 +11140,7 @@ void NetworkInterface::decNumHosts(bool local, bool rxOnlyHost) { if(rxOnlyHost) { /* Decrease total number of RX only hosts */ if (!numTotalRxOnlyHosts) { - ntop->getTrace()->traceEvent(TRACE_WARNING, "Internal Error (%d) on interface %s: Counter overflow", 3, ifname); // <--- + ntop->getTrace()->traceEvent(TRACE_WARNING, "Internal Error (%d) on interface %s: Counter overflow", 3, ifname); } else { numTotalRxOnlyHosts--; } diff --git a/src/RemoteHost.cpp b/src/RemoteHost.cpp index 588d268286..e1d20ade59 100644 --- a/src/RemoteHost.cpp +++ b/src/RemoteHost.cpp @@ -51,7 +51,7 @@ RemoteHost::RemoteHost(NetworkInterface *_iface, int32_t _iface_idx, RemoteHost::~RemoteHost() { /* Decrease number of active hosts */ if(isUnicastHost()) - iface->decNumHosts(isLocalHost(), isRxOnlyHost()); + iface->decNumHosts(isLocalHost(), is_rx_only); } /* *************************************** */