Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/448#discussion_r165844811
  
    --- Diff: src/java/main/org/apache/zookeeper/client/StaticHostProvider.java 
---
    @@ -107,16 +112,43 @@ public 
StaticHostProvider(Collection<InetSocketAddress> serverAddresses,
             lastIndex = -1;              
         }
     
    +    private Set<Class<? extends InetAddress>> supportedAddressTypes() {
    +        Set<Class<? extends InetAddress>> types = new HashSet<>();
    +        try {
    +            Enumeration<NetworkInterface> inets = 
NetworkInterface.getNetworkInterfaces();
    +            while (inets.hasMoreElements()) {
    +                NetworkInterface ne = inets.nextElement();
    +
    +                Enumeration<InetAddress> addrs = ne.getInetAddresses();
    +                while (addrs.hasMoreElements()) {
    +                    InetAddress addr = addrs.nextElement();
    +                    if (addr.isLinkLocalAddress() || 
addr.isLoopbackAddress()) {
    +                        continue;
    +                    }
    +                    types.add(addr.getClass());
    +                }
    +            }
    +        } catch (SocketException e) {
    +            LOG.error("Failed to resolve supported address types: ", e);
    +        }
    +        return types;
    +    }
    +
         private List<InetSocketAddress> 
resolveAndShuffle(Collection<InetSocketAddress> serverAddresses) {
    -        List<InetSocketAddress> tmpList = new 
ArrayList<InetSocketAddress>(serverAddresses.size());       
    +        List<InetSocketAddress> tmpList = new 
ArrayList<InetSocketAddress>(serverAddresses.size());
    +        Set<Class<? extends InetAddress>> supprtedInetTypes = 
supportedAddressTypes();
    --- End diff --
    
    typo in the variable name


---

Reply via email to