mirror of
https://github.com/ntop/ntopng.git
synced 2026-07-10 00:14:24 +00:00
Add atomic to check for concurrency issues
This commit is contained in:
parent
112bf29b9e
commit
0ba4c2f44b
4 changed files with 9 additions and 10 deletions
|
|
@ -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<u_int64_t> totalNumHosts;
|
||||
std::atomic<u_int64_t> numTotalRxOnlyHosts; /* subset of numTotalRxOnlyHosts that have received
|
||||
but never sent any traffic */
|
||||
,
|
||||
numLocalHosts,
|
||||
numLocalRxOnlyHosts /* subset of numLocalHosts that have received but
|
||||
std::atomic<u_int64_t> numLocalHosts;
|
||||
std::atomic<u_int64_t> 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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/* *************************************** */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue