diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-22 16:02:01 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-22 16:02:01 -0700 |
commit | 7711eba297955d4cf3852f36fe7c6d118da38171 (patch) | |
tree | 28aac858e0f6792ffae85a01d74793c10694ea08 /node | |
parent | 1bc451ed10b43e7c1113c9d8129ad468821ab0cb (diff) | |
download | infinitytier-7711eba297955d4cf3852f36fe7c6d118da38171.tar.gz infinitytier-7711eba297955d4cf3852f36fe7c6d118da38171.zip |
More cluster wiring...
Diffstat (limited to 'node')
-rw-r--r-- | node/Cluster.cpp | 4 | ||||
-rw-r--r-- | node/Cluster.hpp | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp index d9514db5..e7aa5a41 100644 --- a/node/Cluster.cpp +++ b/node/Cluster.cpp @@ -504,7 +504,7 @@ void Cluster::doPeriodicTasks() void Cluster::addMember(uint16_t memberId) { - if (memberId >= ZT_CLUSTER_MAX_MEMBERS) + if ((memberId >= ZT_CLUSTER_MAX_MEMBERS)||(memberId == _id)) return; Mutex::Lock _l2(_members[memberId].lock); @@ -622,6 +622,8 @@ bool Cluster::redirectPeer(const Address &peerAddress,const InetAddress &peerPhy void Cluster::_send(uint16_t memberId,StateMessageType type,const void *msg,unsigned int len) { + if ((len + 3) > (ZT_CLUSTER_MAX_MESSAGE_LENGTH - (24 + 2 + 2))) // sanity check + return; _Member &m = _members[memberId]; // assumes m.lock is locked! if ((m.q.size() + len + 3) > ZT_CLUSTER_MAX_MESSAGE_LENGTH) diff --git a/node/Cluster.hpp b/node/Cluster.hpp index 2e60fd6b..6c9a2917 100644 --- a/node/Cluster.hpp +++ b/node/Cluster.hpp @@ -47,7 +47,7 @@ /** * Timeout for cluster members being considered "alive" */ -#define ZT_CLUSTER_TIMEOUT 30000 +#define ZT_CLUSTER_TIMEOUT 10000 /** * How often should we announce that we have a peer? @@ -57,7 +57,7 @@ /** * Desired period between doPeriodicTasks() in milliseconds */ -#define ZT_CLUSTER_PERIODIC_TASK_PERIOD 50 +#define ZT_CLUSTER_PERIODIC_TASK_PERIOD 100 namespace ZeroTier { |