equal
deleted
inserted
replaced
81 private static final int ST_KILLPENDING = 3; |
81 private static final int ST_KILLPENDING = 3; |
82 private static final int ST_KILLED = 4; |
82 private static final int ST_KILLED = 4; |
83 private int state = ST_UNINITIALIZED; |
83 private int state = ST_UNINITIALIZED; |
84 |
84 |
85 // Binding |
85 // Binding |
86 private SocketAddress localAddress; |
86 private InetSocketAddress localAddress; |
87 private SocketAddress remoteAddress; |
87 private InetSocketAddress remoteAddress; |
88 |
88 |
89 // Input/Output open |
89 // Input/Output open |
90 private boolean isInputOpen = true; |
90 private boolean isInputOpen = true; |
91 private boolean isOutputOpen = true; |
91 private boolean isOutputOpen = true; |
92 private boolean readyToConnect = false; |
92 private boolean readyToConnect = false; |
144 @Override |
144 @Override |
145 public SocketAddress getLocalAddress() throws IOException { |
145 public SocketAddress getLocalAddress() throws IOException { |
146 synchronized (stateLock) { |
146 synchronized (stateLock) { |
147 if (!isOpen()) |
147 if (!isOpen()) |
148 throw new ClosedChannelException(); |
148 throw new ClosedChannelException(); |
149 return localAddress; |
149 return Net.getRevealedLocalAddress(localAddress); |
150 } |
150 } |
151 } |
151 } |
152 |
152 |
153 @Override |
153 @Override |
154 public SocketAddress getRemoteAddress() throws IOException { |
154 public SocketAddress getRemoteAddress() throws IOException { |
545 |
545 |
546 protected void implConfigureBlocking(boolean block) throws IOException { |
546 protected void implConfigureBlocking(boolean block) throws IOException { |
547 IOUtil.configureBlocking(fd, block); |
547 IOUtil.configureBlocking(fd, block); |
548 } |
548 } |
549 |
549 |
550 public SocketAddress localAddress() { |
550 public InetSocketAddress localAddress() { |
551 synchronized (stateLock) { |
551 synchronized (stateLock) { |
552 return localAddress; |
552 return localAddress; |
553 } |
553 } |
554 } |
554 } |
555 |
555 |
972 |
972 |
973 public int getFDVal() { |
973 public int getFDVal() { |
974 return fdVal; |
974 return fdVal; |
975 } |
975 } |
976 |
976 |
|
977 @Override |
977 public String toString() { |
978 public String toString() { |
978 StringBuffer sb = new StringBuffer(); |
979 StringBuffer sb = new StringBuffer(); |
979 sb.append(this.getClass().getSuperclass().getName()); |
980 sb.append(this.getClass().getSuperclass().getName()); |
980 sb.append('['); |
981 sb.append('['); |
981 if (!isOpen()) |
982 if (!isOpen()) |
995 sb.append(" ishut"); |
996 sb.append(" ishut"); |
996 if (!isOutputOpen) |
997 if (!isOutputOpen) |
997 sb.append(" oshut"); |
998 sb.append(" oshut"); |
998 break; |
999 break; |
999 } |
1000 } |
1000 if (localAddress() != null) { |
1001 InetSocketAddress addr = localAddress(); |
|
1002 if (addr != null) { |
1001 sb.append(" local="); |
1003 sb.append(" local="); |
1002 sb.append(localAddress().toString()); |
1004 sb.append(Net.getRevealedLocalAddressAsString(addr)); |
1003 } |
1005 } |
1004 if (remoteAddress() != null) { |
1006 if (remoteAddress() != null) { |
1005 sb.append(" remote="); |
1007 sb.append(" remote="); |
1006 sb.append(remoteAddress().toString()); |
1008 sb.append(remoteAddress().toString()); |
1007 } |
1009 } |