diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-09 09:54:39 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-09-09 09:54:39 -0700 |
| commit | a43c3fbf2e03f99c51383123423d86656ac252bf (patch) | |
| tree | ba09c5b1de23f36984d7167d6c84c7b7add1e16f /node/SelfAwareness.hpp | |
| parent | ca6ec120a9b6b99850c827eec2450f89e2331dca (diff) | |
| parent | 4fbcad246850d7bf00289b898f4a26065276d6e2 (diff) | |
| download | infinitytier-a43c3fbf2e03f99c51383123423d86656ac252bf.tar.gz infinitytier-a43c3fbf2e03f99c51383123423d86656ac252bf.zip | |
Merge branch 'adamierymenko-dev' into netcon
Diffstat (limited to 'node/SelfAwareness.hpp')
| -rw-r--r-- | node/SelfAwareness.hpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/node/SelfAwareness.hpp b/node/SelfAwareness.hpp index d3b79d18..3133553e 100644 --- a/node/SelfAwareness.hpp +++ b/node/SelfAwareness.hpp @@ -28,10 +28,9 @@ #ifndef ZT_SELFAWARENESS_HPP #define ZT_SELFAWARENESS_HPP -#include <map> -#include <vector> - +#include "Constants.hpp" #include "InetAddress.hpp" +#include "Hashtable.hpp" #include "Address.hpp" #include "Mutex.hpp" @@ -66,17 +65,14 @@ public: */ void clean(uint64_t now); - /** - * @return True if our external (global scope) IPv4 ports appear to be randomized by a NAT device - */ - bool areGlobalIPv4PortsRandomized() const; - private: struct PhySurfaceKey { Address reporter; InetAddress::IpScope scope; + inline unsigned long hashCode() const throw() { return ((unsigned long)reporter.toInt() + (unsigned long)scope); } + PhySurfaceKey() : reporter(),scope(InetAddress::IP_SCOPE_NONE) {} PhySurfaceKey(const Address &r,InetAddress::IpScope s) : reporter(r),scope(s) {} inline bool operator<(const PhySurfaceKey &k) const throw() { return ((reporter < k.reporter) ? true : ((reporter == k.reporter) ? ((int)scope < (int)k.scope) : false)); } @@ -93,7 +89,7 @@ private: const RuntimeEnvironment *RR; - std::map< PhySurfaceKey,PhySurfaceEntry > _phy; + Hashtable< PhySurfaceKey,PhySurfaceEntry > _phy; Mutex _phy_m; }; |
