-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Transport client: Don't validate node in handshake #30737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
eb31f0a
5db5fc5
25c288e
53c087b
2b2b036
8704b5f
5ab1eae
d93cb12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -314,6 +314,11 @@ public boolean nodeConnected(DiscoveryNode node) { | |
| return isLocalNode(node) || transport.nodeConnected(node); | ||
| } | ||
|
|
||
| /** | ||
| * Connect to the specified node with the default connection profile | ||
| * | ||
| * @param node the node to connect to | ||
| */ | ||
| public void connectToNode(DiscoveryNode node) throws ConnectTransportException { | ||
| connectToNode(node, null); | ||
| } | ||
|
|
@@ -325,13 +330,25 @@ public void connectToNode(DiscoveryNode node) throws ConnectTransportException { | |
| * @param connectionProfile the connection profile to use when connecting to this node | ||
| */ | ||
| public void connectToNode(final DiscoveryNode node, ConnectionProfile connectionProfile) { | ||
| connectToNode(node, connectionProfile, true); | ||
| } | ||
|
|
||
| /** | ||
| * Connect to the specified node with the given connection profile. This method allows the caller to | ||
| * specify whether the node connection should be validated against the specified node. | ||
| * | ||
| * @param node the node to connect to | ||
| * @param connectionProfile the connection profile to use when connecting to this node | ||
| * @param validateNodeConnection boolean indicating if the node connection should be validated | ||
| */ | ||
| public void connectToNode(final DiscoveryNode node, ConnectionProfile connectionProfile, boolean validateNodeConnection) { | ||
|
||
| if (isLocalNode(node)) { | ||
| return; | ||
| } | ||
| transport.connectToNode(node, connectionProfile, (newConnection, actualProfile) -> { | ||
| // We don't validate cluster names to allow for CCS connections. | ||
| final DiscoveryNode remote = handshake(newConnection, actualProfile.getHandshakeTimeout().millis(), cn -> true); | ||
| if (node.equals(remote) == false) { | ||
| if (validateNodeConnection && node.equals(remote) == false) { | ||
| throw new ConnectTransportException(node, "handshake failed. unexpected remote node " + remote); | ||
| } | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateInHandshakenot used anymore?