zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anmolnar <...@git.apache.org>
Subject [GitHub] zookeeper pull request #648: ZOOKEEPER-3156: Add in option to canonicalize h...
Date Fri, 28 Sep 2018 20:16:02 GMT
Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/648#discussion_r221367991
  
    --- Diff: src/java/main/org/apache/zookeeper/ClientCnxn.java ---
    @@ -990,6 +992,27 @@ private void sendPing() {
             private boolean saslLoginFailed = false;
     
             private void startConnect(InetSocketAddress addr) throws IOException {
    +            boolean canonicalize = true;
    +            try {
    +                canonicalize = Boolean.parseBoolean(System.getProperty(ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME,
"true"));
    +            } catch (IllegalArgumentException ea) {
    +                //ignored ...
    +            }
    +
    +            if (canonicalize) {
    +                try {
    +                    InetAddress ia = addr.getAddress();
    +                    LOG.warn("ia {}", ia);
    +                    if (ia == null) {
    +                        ia = InetAddress.getByName(addr.getHostName());
    --- End diff --
    
    If the original address is unresolved, you should throw exception immediately. That means
HostProvider already tried to resolve the address, but failed. No point trying it again here.


---

Mime
View raw message