From 94f4316a0ecb56f7e34422a7dfed73efb2bbe1a3 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 9 Nov 2015 14:54:05 -0800 Subject: Fix for possible high CPU usage on multicast queries. --- node/RuntimeEnvironment.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'node/RuntimeEnvironment.hpp') 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 -- cgit v1.2.3