Java client nodes using multicast discovery connect to one another, closes #1135.
This commit is contained in:
parent
cbb1c35f94
commit
c066b6ae4a
|
@ -97,6 +97,16 @@ public class DiscoveryNode implements Streamable, Serializable {
|
|||
this.address = address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this node form a connection to the provided node.
|
||||
*/
|
||||
public boolean shouldConnectTo(DiscoveryNode otherNode) {
|
||||
if (clientNode() && otherNode.clientNode()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The address that the node can be communicated with.
|
||||
*/
|
||||
|
|
|
@ -341,11 +341,6 @@ public class InternalClusterService extends AbstractLifecycleComponent<ClusterSe
|
|||
}
|
||||
|
||||
private boolean nodeRequiresConnection(DiscoveryNode node) {
|
||||
if (localNode().clientNode()) {
|
||||
if (node.clientNode()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return localNode().shouldConnectTo(node);
|
||||
}
|
||||
}
|
|
@ -348,7 +348,16 @@ public class MulticastZenPing extends AbstractLifecycleComponent<ZenPing> implem
|
|||
continue;
|
||||
}
|
||||
if (!clusterName.equals(MulticastZenPing.this.clusterName)) {
|
||||
// not our cluster, ignore it...
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("[{}] received ping_request from [{}], but wrong cluster_name [{}], expected [{}], ignoring", id, requestingNode, clusterName, MulticastZenPing.this.clusterName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// don't connect between two client nodes, no need for that...
|
||||
if (!discoveryNodes.localNode().shouldConnectTo(requestingNode)) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("[{}] received ping_request from [{}], both are client nodes, ignoring", id, requestingNode, clusterName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
final MulticastPingResponse multicastPingResponse = new MulticastPingResponse();
|
||||
|
|
Loading…
Reference in New Issue