equal
deleted
inserted
replaced
51 protected final FileDescriptor fd; |
51 protected final FileDescriptor fd; |
52 |
52 |
53 // protects state, localAddress, and remoteAddress |
53 // protects state, localAddress, and remoteAddress |
54 protected final Object stateLock = new Object(); |
54 protected final Object stateLock = new Object(); |
55 |
55 |
56 protected volatile SocketAddress localAddress = null; |
56 protected volatile InetSocketAddress localAddress = null; |
57 protected volatile SocketAddress remoteAddress = null; |
57 protected volatile InetSocketAddress remoteAddress = null; |
58 |
58 |
59 // State, increases monotonically |
59 // State, increases monotonically |
60 static final int ST_UNINITIALIZED = -1; |
60 static final int ST_UNINITIALIZED = -1; |
61 static final int ST_UNCONNECTED = 0; |
61 static final int ST_UNCONNECTED = 0; |
62 static final int ST_PENDING = 1; |
62 static final int ST_PENDING = 1; |
440 |
440 |
441 @Override |
441 @Override |
442 public final SocketAddress getLocalAddress() throws IOException { |
442 public final SocketAddress getLocalAddress() throws IOException { |
443 if (!isOpen()) |
443 if (!isOpen()) |
444 throw new ClosedChannelException(); |
444 throw new ClosedChannelException(); |
445 return localAddress; |
445 return Net.getRevealedLocalAddress(localAddress); |
446 } |
446 } |
447 |
447 |
448 @Override |
448 @Override |
449 public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value) |
449 public final <T> AsynchronousSocketChannel setOption(SocketOption<T> name, T value) |
450 throws IOException |
450 throws IOException |
580 sb.append(" oshut"); |
580 sb.append(" oshut"); |
581 break; |
581 break; |
582 } |
582 } |
583 if (localAddress != null) { |
583 if (localAddress != null) { |
584 sb.append(" local="); |
584 sb.append(" local="); |
585 sb.append(localAddress.toString()); |
585 sb.append( |
|
586 Net.getRevealedLocalAddressAsString(localAddress)); |
586 } |
587 } |
587 if (remoteAddress != null) { |
588 if (remoteAddress != null) { |
588 sb.append(" remote="); |
589 sb.append(" remote="); |
589 sb.append(remoteAddress.toString()); |
590 sb.append(remoteAddress.toString()); |
590 } |
591 } |