Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/489#discussion_r195968969
--- 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 --
@maoling I was suggesting to change the ip address format passed in from
din to be [xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:xxxx instead of the one
without '[]', and reuse the splitWithLeadingHostname code.
---