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

    https://github.com/apache/zookeeper/pull/489#discussion_r194216407
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
    @@ -222,15 +222,15 @@ static public InitialMessage parse(Long 
protocolVersion, DataInputStream din)
                             num_read, remaining, sid);
                 }
     
    -            // FIXME: IPv6 is not supported. Using something like Guava's 
HostAndPort
    -            //        parser would be good.
                 String addr = new String(b);
    -            String[] host_port = addr.split(":");
    -
    -            if (host_port.length != 2) {
    -                throw new InitialMessageException("Badly formed address: 
%s", addr);
    +            int pos = addr.lastIndexOf(":");
    +           
    +            if (pos == -1 || pos + 1  == (addr.length() )) {
    --- End diff --
    
    I think the better way to do this is updating the initiateConnection 
function to pass in IPv6 literal address "[%s]:%s", and here we can use 
QuorumPeer.splitWithLeadingHostname to check and get IPv6 host and port.


---

Reply via email to