summaryrefslogtreecommitdiff
path: root/node/RuntimeEnvironment.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 14:54:05 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 14:54:05 -0800
commit94f4316a0ecb56f7e34422a7dfed73efb2bbe1a3 (patch)
tree7550f5013ca182226553c8666f26ed2f5f3c0546 /node/RuntimeEnvironment.hpp
parent35c4e28f314881f3f6647deaaaf3e58d2ccb5417 (diff)
downloadinfinitytier-94f4316a0ecb56f7e34422a7dfed73efb2bbe1a3.tar.gz
infinitytier-94f4316a0ecb56f7e34422a7dfed73efb2bbe1a3.zip
Fix for possible high CPU usage on multicast queries.
Diffstat (limited to 'node/RuntimeEnvironment.hpp')
-rw-r--r--node/RuntimeEnvironment.hpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/node/RuntimeEnvironment.hpp b/node/RuntimeEnvironment.hpp
index 18d9e8e5..10cc6ec0 100644
--- a/node/RuntimeEnvironment.hpp
+++ b/node/RuntimeEnvironment.hpp
@@ -57,12 +57,12 @@ public:
node(n)
,identity()
,localNetworkController((NetworkController *)0)
- ,dp((DeferredPackets *)0)
,sw((Switch *)0)
,mc((Multicaster *)0)
,antiRec((AntiRecursion *)0)
,topology((Topology *)0)
,sa((SelfAwareness *)0)
+ ,dp((DeferredPackets *)0)
#ifdef ZT_ENABLE_CLUSTER
,cluster((Cluster *)0)
#endif
@@ -80,10 +80,6 @@ public:
// This is set externally to an instance of this base class
NetworkController *localNetworkController;
- // This is created if background threads call Node::backgroundThreadMain().
- DeferredPackets *volatile dp; // can be read without lock but not written
- Mutex dpSetLock;
-
/*
* Order matters a bit here. These are constructed in this order
* and then deleted in the opposite order on Node exit. The order ensures
@@ -97,10 +93,15 @@ public:
AntiRecursion *antiRec;
Topology *topology;
SelfAwareness *sa;
+ DeferredPackets *dp;
#ifdef ZT_ENABLE_CLUSTER
Cluster *cluster;
#endif
+
+ // This is set to >0 if background threads are waiting on deferred
+ // packets, otherwise 'dp' should not be used.
+ volatile int dpEnabled;
};
} // namespace ZeroTier