summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-05 10:47:13 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-05 10:47:13 -0700
commitd8b89b0c86e9454ce95a7c7ad07549ceeba916a0 (patch)
tree3273e13945af645af382edb205ae826a2f800e88 /node
parente0ad854d19e215869139782594329e51ae0812f4 (diff)
downloadinfinitytier-d8b89b0c86e9454ce95a7c7ad07549ceeba916a0.tar.gz
infinitytier-d8b89b0c86e9454ce95a7c7ad07549ceeba916a0.zip
Fix Cluster to send from a designated endpoint address instead of wildcard.
Diffstat (limited to 'node')
-rw-r--r--node/Cluster.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp
index e4c4524a..61903307 100644
--- a/node/Cluster.cpp
+++ b/node/Cluster.cpp
@@ -570,10 +570,19 @@ void Cluster::sendViaCluster(const Address &fromPeerAddress,const Address &toPee
Mutex::Lock _l2(_members[mostRecentMemberId].lock);
if (buf.size() > 0)
_send(mostRecentMemberId,CLUSTER_MESSAGE_PROXY_UNITE,buf.data(),buf.size());
- if (_members[mostRecentMemberId].zeroTierPhysicalEndpoints.size() > 0) {
- TRACE("sendViaCluster relaying %u bytes from %s to %s by way of %u",len,fromPeerAddress.toString().c_str(),toPeerAddress.toString().c_str(),(unsigned int)mostRecentMemberId);
- RR->node->putPacket(InetAddress(),_members[mostRecentMemberId].zeroTierPhysicalEndpoints.front(),data,len);
+
+ for(std::vector<InetAddress>::const_iterator i1(_zeroTierPhysicalEndpoints.begin());i1!=_zeroTierPhysicalEndpoints.end();++i1) {
+ for(std::vector<InetAddress>::const_iterator i2(_members[mostRecentMemberId].zeroTierPhysicalEndpoints.begin());i2!=_members[mostRecentMemberId].zeroTierPhysicalEndpoints.end();++i2) {
+ if (i1->ss_family == i2->ss_family) {
+ TRACE("sendViaCluster relaying %u bytes from %s to %s by way of %u (%s->%s)",len,fromPeerAddress.toString().c_str(),toPeerAddress.toString().c_str(),(unsigned int)mostRecentMemberId,i1->toString().c_str(),i2->toString().c_str());
+ RR->node->putPacket(*i1,*i2,data,len);
+ return;
+ }
+ }
}
+
+ TRACE("sendViaCluster relaying %u bytes from %s to %s by way of %u failed: no common endpoints with the same address family!",len,fromPeerAddress.toString().c_str(),toPeerAddress.toString().c_str(),(unsigned int)mostRecentMemberId);
+ return;
}
}