summaryrefslogtreecommitdiff
path: root/node/Multicaster.hpp
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-09-26 13:47:55 -0700
committerGrant Limberg <glimberg@gmail.com>2015-09-26 13:47:55 -0700
commite8cdff3eafd8096da22122eabddf57a09fe2bb90 (patch)
treed231aa6d9ccccc8ced6e1ead606ce16ff551cab9 /node/Multicaster.hpp
parent53d98343b7b444508259f6f1643e8d6724fb11e9 (diff)
parentf69454ec9879a0b0a424f743ca144d1123ef7e99 (diff)
downloadinfinitytier-e8cdff3eafd8096da22122eabddf57a09fe2bb90.tar.gz
infinitytier-e8cdff3eafd8096da22122eabddf57a09fe2bb90.zip
Merge branch 'adamierymenko-dev' into android-jni-dev
also update for changed function calls that now accept a local address # Conflicts: # include/ZeroTierOne.h # java/CMakeLists.txt # java/jni/Android.mk # java/jni/ZT1_jnicache.cpp # java/jni/ZT1_jnilookup.h # java/jni/ZT1_jniutils.cpp # java/jni/com_zerotierone_sdk_Node.cpp
Diffstat (limited to 'node/Multicaster.hpp')
-rw-r--r--node/Multicaster.hpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/node/Multicaster.hpp b/node/Multicaster.hpp
index 0dd199f9..898c4db7 100644
--- a/node/Multicaster.hpp
+++ b/node/Multicaster.hpp
@@ -36,6 +36,7 @@
#include <list>
#include "Constants.hpp"
+#include "Hashtable.hpp"
#include "Address.hpp"
#include "MAC.hpp"
#include "MulticastGroup.hpp"
@@ -56,6 +57,18 @@ class Packet;
class Multicaster : NonCopyable
{
private:
+ struct Key
+ {
+ Key() : nwid(0),mg() {}
+ Key(uint64_t n,const MulticastGroup &g) : nwid(n),mg(g) {}
+
+ uint64_t nwid;
+ MulticastGroup mg;
+
+ inline bool operator==(const Key &k) const throw() { return ((nwid == k.nwid)&&(mg == k.mg)); }
+ inline unsigned long hashCode() const throw() { return (mg.hashCode() ^ (unsigned long)(nwid ^ (nwid >> 32))); }
+ };
+
struct MulticastGroupMember
{
MulticastGroupMember() {}
@@ -89,7 +102,7 @@ public:
inline void add(uint64_t now,uint64_t nwid,const MulticastGroup &mg,const Address &member)
{
Mutex::Lock _l(_groups_m);
- _add(now,nwid,mg,_groups[std::pair<uint64_t,MulticastGroup>(nwid,mg)],member);
+ _add(now,nwid,mg,_groups[Multicaster::Key(nwid,mg)],member);
}
/**
@@ -181,7 +194,7 @@ private:
void _add(uint64_t now,uint64_t nwid,const MulticastGroup &mg,MulticastGroupStatus &gs,const Address &member);
const RuntimeEnvironment *RR;
- std::map< std::pair<uint64_t,MulticastGroup>,MulticastGroupStatus > _groups;
+ Hashtable<Multicaster::Key,MulticastGroupStatus> _groups;
Mutex _groups_m;
};