summaryrefslogtreecommitdiff
path: root/node/Cluster.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-22 16:02:01 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-22 16:02:01 -0700
commit7711eba297955d4cf3852f36fe7c6d118da38171 (patch)
tree28aac858e0f6792ffae85a01d74793c10694ea08 /node/Cluster.cpp
parent1bc451ed10b43e7c1113c9d8129ad468821ab0cb (diff)
downloadinfinitytier-7711eba297955d4cf3852f36fe7c6d118da38171.tar.gz
infinitytier-7711eba297955d4cf3852f36fe7c6d118da38171.zip
More cluster wiring...
Diffstat (limited to 'node/Cluster.cpp')
-rw-r--r--node/Cluster.cpp4
1 files changed, 3 insertions, 1 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)