summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Cluster.cpp4
-rw-r--r--node/Cluster.hpp4
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 {