Github user Vile2539 commented on a diff in the pull request:
https://github.com/apache/curator/pull/205#discussion_r127058434
--- Diff:
curator-framework/src/main/java/org/apache/curator/framework/imps/EnsembleTracker.java
---
@@ -166,12 +166,26 @@ public static String
configToConnectionString(QuorumVerifier data) throws Except
StringBuilder sb = new StringBuilder();
for ( QuorumPeer.QuorumServer server :
data.getAllMembers().values() )
{
+ if ( server.clientAddr == null )
+ {
+ // Invalid client address configuration in zoo.cfg
+ continue;
+ }
if ( sb.length() != 0 )
{
sb.append(",");
}
- InetSocketAddress address =
Objects.firstNonNull(server.clientAddr, server.addr);
-
sb.append(address.getAddress().getHostAddress()).append(":").append(address.getPort());
+ InetAddress wildcardAddress = new
InetSocketAddress(0).getAddress();
+ String hostAddress;
+ if ( wildcardAddress.equals(server.clientAddr.getAddress()) )
+ {
+ hostAddress = server.addr.getAddress().getHostAddress();
+ }
+ else
+ {
+ hostAddress =
server.clientAddr.getAddress().getHostAddress();
+ }
+
sb.append(hostAddress).append(":").append(server.clientAddr.getPort());
--- End diff --
I don't believe getHostAddress() involves any DNS lookups, hostname
resolution, etc. It just gets the String representation of the byte array on
the InetAddressHolder. I may be mistaken about this though.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---