summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Mutex.hpp22
-rw-r--r--node/Network.hpp3
-rw-r--r--node/NonCopyable.hpp46
-rw-r--r--node/Path.hpp3
-rw-r--r--node/Peer.hpp3
-rw-r--r--node/Switch.hpp3
6 files changed, 19 insertions, 61 deletions
diff --git a/node/Mutex.hpp b/node/Mutex.hpp
index cbd80524..a60a00b2 100644
--- a/node/Mutex.hpp
+++ b/node/Mutex.hpp
@@ -28,7 +28,6 @@
#define ZT_MUTEX_HPP
#include "Constants.hpp"
-#include "NonCopyable.hpp"
#ifdef __UNIX_LIKE__
@@ -41,7 +40,7 @@ namespace ZeroTier {
#if defined(__GNUC__) && (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64))
// 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
+class Mutex
{
public:
Mutex() :
@@ -67,7 +66,7 @@ public:
/**
* Uses C++ contexts and constructor/destructor to lock/unlock automatically
*/
- class Lock : NonCopyable
+ class Lock
{
public:
Lock(Mutex &m) :
@@ -92,6 +91,9 @@ public:
};
private:
+ Mutex(const Mutex &) {}
+ const Mutex &operator=(const Mutex &) { return *this; }
+
uint16_t nextTicket;
uint16_t nowServing;
};
@@ -99,7 +101,7 @@ private:
#else
// libpthread based mutex lock
-class Mutex : NonCopyable
+class Mutex
{
public:
Mutex()
@@ -122,7 +124,7 @@ public:
pthread_mutex_unlock(&((const_cast <Mutex *> (this))->_mh));
}
- class Lock : NonCopyable
+ class Lock
{
public:
Lock(Mutex &m) :
@@ -147,6 +149,9 @@ public:
};
private:
+ Mutex(const Mutex &) {}
+ const Mutex &operator=(const Mutex &) { return *this; }
+
pthread_mutex_t _mh;
};
@@ -164,7 +169,7 @@ private:
namespace ZeroTier {
// Windows critical section based lock
-class Mutex : NonCopyable
+class Mutex
{
public:
Mutex()
@@ -197,7 +202,7 @@ public:
(const_cast <Mutex *> (this))->unlock();
}
- class Lock : NonCopyable
+ class Lock
{
public:
Lock(Mutex &m) :
@@ -222,6 +227,9 @@ public:
};
private:
+ Mutex(const Mutex &) {}
+ const Mutex &operator=(const Mutex &) { return *this; }
+
CRITICAL_SECTION _cs;
};
diff --git a/node/Network.hpp b/node/Network.hpp
index db285108..95b5483a 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -38,7 +38,6 @@
#include <stdexcept>
#include "Constants.hpp"
-#include "NonCopyable.hpp"
#include "Hashtable.hpp"
#include "Address.hpp"
#include "Mutex.hpp"
@@ -63,7 +62,7 @@ class Peer;
/**
* A virtual LAN
*/
-class Network : NonCopyable
+class Network
{
friend class SharedPtr<Network>;
diff --git a/node/NonCopyable.hpp b/node/NonCopyable.hpp
deleted file mode 100644
index 31107a50..00000000
--- a/node/NonCopyable.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ZeroTier One - Network Virtualization Everywhere
- * Copyright (C) 2011-2018 ZeroTier, Inc. https://www.zerotier.com/
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * --
- *
- * You can be released from the requirements of the license by purchasing
- * a commercial license. Buying such a license is mandatory as soon as you
- * develop commercial closed-source software that incorporates or links
- * directly against ZeroTier software without disclosing the source code
- * of your own application.
- */
-
-#ifndef ZT_NONCOPYABLE_HPP__
-#define ZT_NONCOPYABLE_HPP__
-
-namespace ZeroTier {
-
-/**
- * A simple concept that belongs in the C++ language spec
- */
-class NonCopyable
-{
-protected:
- NonCopyable() {}
-private:
- NonCopyable(const NonCopyable&);
- const NonCopyable& operator=(const NonCopyable&);
-};
-
-} // namespace ZeroTier
-
-#endif
diff --git a/node/Path.hpp b/node/Path.hpp
index 62d750b7..3d468ad9 100644
--- a/node/Path.hpp
+++ b/node/Path.hpp
@@ -38,7 +38,6 @@
#include "InetAddress.hpp"
#include "SharedPtr.hpp"
#include "AtomicCounter.hpp"
-#include "NonCopyable.hpp"
#include "Utils.hpp"
/**
@@ -53,7 +52,7 @@ class RuntimeEnvironment;
/**
* A path across the physical network
*/
-class Path : NonCopyable
+class Path
{
friend class SharedPtr<Path>;
diff --git a/node/Peer.hpp b/node/Peer.hpp
index 99216bab..b6f3c695 100644
--- a/node/Peer.hpp
+++ b/node/Peer.hpp
@@ -49,7 +49,6 @@
#include "AtomicCounter.hpp"
#include "Hashtable.hpp"
#include "Mutex.hpp"
-#include "NonCopyable.hpp"
#define ZT_PEER_MAX_SERIALIZED_STATE_SIZE (sizeof(Peer) + 32 + (sizeof(Path) * 2))
@@ -58,7 +57,7 @@ namespace ZeroTier {
/**
* Peer on P2P Network (virtual layer 1)
*/
-class Peer : NonCopyable
+class Peer
{
friend class SharedPtr<Peer>;
diff --git a/node/Switch.hpp b/node/Switch.hpp
index 08208735..906f418e 100644
--- a/node/Switch.hpp
+++ b/node/Switch.hpp
@@ -35,7 +35,6 @@
#include "Constants.hpp"
#include "Mutex.hpp"
#include "MAC.hpp"
-#include "NonCopyable.hpp"
#include "Packet.hpp"
#include "Utils.hpp"
#include "InetAddress.hpp"
@@ -58,7 +57,7 @@ class Peer;
* packets from tap devices, and this sends them where they need to go and
* wraps/unwraps accordingly. It also handles queues and timeouts and such.
*/
-class Switch : NonCopyable
+class Switch
{
public:
Switch(const RuntimeEnvironment *renv);