-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Transport: Remove parsing of port ranges #7561
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 all commits
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 |
|---|---|---|
|
|
@@ -427,34 +427,12 @@ protected void doClose() throws ElasticsearchException { | |
| } | ||
|
|
||
| @Override | ||
| public TransportAddress[] addressesFromString(String address) throws Exception { | ||
| int index = address.indexOf('['); | ||
| if (index != -1) { | ||
| String host = address.substring(0, index); | ||
| Set<String> ports = Strings.commaDelimitedListToSet(address.substring(index + 1, address.indexOf(']'))); | ||
| List<TransportAddress> addresses = Lists.newArrayList(); | ||
| for (String port : ports) { | ||
| int[] iPorts = new PortsRange(port).ports(); | ||
| for (int iPort : iPorts) { | ||
| addresses.add(new InetSocketTransportAddress(host, iPort)); | ||
| } | ||
| } | ||
| return addresses.toArray(new TransportAddress[addresses.size()]); | ||
| } else { | ||
| index = address.lastIndexOf(':'); | ||
| if (index == -1) { | ||
| List<TransportAddress> addresses = Lists.newArrayList(); | ||
| int[] iPorts = new PortsRange(this.port).ports(); | ||
| for (int iPort : iPorts) { | ||
| addresses.add(new InetSocketTransportAddress(address, iPort)); | ||
| } | ||
| return addresses.toArray(new TransportAddress[addresses.size()]); | ||
| } else { | ||
| String host = address.substring(0, index); | ||
| int port = Integer.parseInt(address.substring(index + 1)); | ||
| return new TransportAddress[]{new InetSocketTransportAddress(host, port)}; | ||
| } | ||
| public TransportAddress addressFromString(String address) throws Exception { | ||
| int index = address.lastIndexOf(':'); | ||
| if (index == -1) { | ||
| return new InetSocketTransportAddress(address, Integer.parseInt(this.port)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will not work, right? cause the default is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am confused here. This is not about binding to a port when starting, only about connecting to other nodes, as far as I can judge the source codes. Starting up several nodes in parallel on one machines still works as expected |
||
| } | ||
| return new InetSocketTransportAddress(address.substring(0, index), Integer.parseInt(address.substring(index + 1))); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
We talked with @kimchy a while ago about increasing LIMIT_PORTS_COUNT to 2.
See thread here: elastic/elasticsearch-cloud-aws#99 (comment)
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.
And the related issue here: #7090