From 8ef4edebbfeead53e5b2b454086e21e42e809aab Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 5 Nov 2015 12:22:58 -0800 Subject: Deferred decode for HELLO to prevent HELLOcalypse under high load of new peers. --- node/RuntimeEnvironment.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'node/RuntimeEnvironment.hpp') diff --git a/node/RuntimeEnvironment.hpp b/node/RuntimeEnvironment.hpp index 2ec88f72..18d9e8e5 100644 --- a/node/RuntimeEnvironment.hpp +++ b/node/RuntimeEnvironment.hpp @@ -32,6 +32,7 @@ #include "Constants.hpp" #include "Identity.hpp" +#include "Mutex.hpp" namespace ZeroTier { @@ -44,6 +45,7 @@ class AntiRecursion; class NetworkController; class SelfAwareness; class Cluster; +class DeferredPackets; /** * Holds global state for an instance of ZeroTier::Node @@ -55,6 +57,7 @@ public: node(n) ,identity() ,localNetworkController((NetworkController *)0) + ,dp((DeferredPackets *)0) ,sw((Switch *)0) ,mc((Multicaster *)0) ,antiRec((AntiRecursion *)0) @@ -77,6 +80,10 @@ 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 -- cgit v1.2.3