You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by lvfangmin <gi...@git.apache.org> on 2018/07/21 18:23:11 UTC
[GitHub] zookeeper pull request #544: ZOOKEEPER-3009 : fix the related bugs in branch...
Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/544#discussion_r204217429
--- Diff: src/java/main/org/apache/zookeeper/server/NIOServerCnxnFactory.java ---
@@ -129,11 +129,14 @@ public int getLocalPort(){
return ss.socket().getLocalPort();
}
- private void addCnxn(NIOServerCnxn cnxn) {
+ private void addCnxn(NIOServerCnxn cnxn) throws IOException {
synchronized (cnxns) {
cnxns.add(cnxn);
synchronized (ipMap){
- InetAddress addr = cnxn.sock.socket().getInetAddress();
+ InetAddress addr = cnxn.getSocketAddress();
+ if (addr == null) {
+ throw new IOException("Socket of " + cnxn + " has been closed");
--- End diff --
nit: keep indent.
---