diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-01-11 14:29:57 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-01-11 14:29:57 -0800 |
commit | f87326fc21fb6db0944730ba1fe961d8bb249450 (patch) | |
tree | 518cd8a9ef3f44dafae5065870571e6ff65429fe /node | |
parent | 0574a70fac7ead502b983252583d5f05191b29cb (diff) | |
download | infinitytier-f87326fc21fb6db0944730ba1fe961d8bb249450.tar.gz infinitytier-f87326fc21fb6db0944730ba1fe961d8bb249450.zip |
Fixes for lock ordering -- GitHub issue #573
Diffstat (limited to 'node')
-rw-r--r-- | node/Mutex.hpp | 3 | ||||
-rw-r--r-- | node/Node.hpp | 2 | ||||
-rw-r--r-- | node/Topology.cpp | 8 |
3 files changed, 7 insertions, 6 deletions
diff --git a/node/Mutex.hpp b/node/Mutex.hpp index cbd80524..e0917f01 100644 --- a/node/Mutex.hpp +++ b/node/Mutex.hpp @@ -38,7 +38,8 @@ namespace ZeroTier {
-#if defined(__GNUC__) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
+//#if defined(__GNUC__) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
+#if 0
// Inline ticket lock on x64 systems with GCC and CLANG (Mac, Linux) -- this is really fast as long as locking durations are very short
class Mutex : NonCopyable
diff --git a/node/Node.hpp b/node/Node.hpp index 82f35c56..79284b63 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -284,7 +284,7 @@ private: Address _remoteTraceTarget; enum Trace::Level _remoteTraceLevel; - int64_t _now; + volatile int64_t _now; int64_t _lastPingCheck; int64_t _lastHousekeepingRun; int64_t _lastMemoizedTraceSettings; diff --git a/node/Topology.cpp b/node/Topology.cpp index fa9868e9..17a0eee4 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -162,8 +162,8 @@ SharedPtr<Peer> Topology::getUpstreamPeer() unsigned int bestq = ~((unsigned int)0); const SharedPtr<Peer> *best = (const SharedPtr<Peer> *)0; - Mutex::Lock _l1(_peers_m); - Mutex::Lock _l2(_upstreams_m); + Mutex::Lock _l2(_peers_m); + Mutex::Lock _l1(_upstreams_m); for(std::vector<Address>::const_iterator a(_upstreamAddresses.begin());a!=_upstreamAddresses.end();++a) { const SharedPtr<Peer> *p = _peers.get(*a); @@ -252,8 +252,8 @@ bool Topology::addWorld(void *tPtr,const World &newWorld,bool alwaysAcceptNew) if ((newWorld.type() != World::TYPE_PLANET)&&(newWorld.type() != World::TYPE_MOON)) return false; - Mutex::Lock _l1(_upstreams_m); Mutex::Lock _l2(_peers_m); + Mutex::Lock _l1(_upstreams_m); World *existing = (World *)0; switch(newWorld.type()) { @@ -341,8 +341,8 @@ void Topology::addMoon(void *tPtr,const uint64_t id,const Address &seed) void Topology::removeMoon(void *tPtr,const uint64_t id) { - Mutex::Lock _l1(_upstreams_m); Mutex::Lock _l2(_peers_m); + Mutex::Lock _l1(_upstreams_m); std::vector<World> nm; for(std::vector<World>::const_iterator m(_moons.begin());m!=_moons.end();++m) { |