src/share/classes/sun/nio/ch/DatagramChannelImpl.java
Print this page
*** 709,725 ****
remoteAddress = sa;
sender = isa;
cachedSenderInetAddress = isa.getAddress();
cachedSenderPort = isa.getPort();
! // Socket was not bound before connecting,
! if (localAddress == null) {
localAddress = Net.localAddress(fd);
}
}
}
- }
return this;
}
public DatagramChannel disconnect() throws IOException {
synchronized(readLock) {
--- 709,723 ----
remoteAddress = sa;
sender = isa;
cachedSenderInetAddress = isa.getAddress();
cachedSenderPort = isa.getPort();
! // set or refresh local address
localAddress = Net.localAddress(fd);
}
}
}
return this;
}
public DatagramChannel disconnect() throws IOException {
synchronized(readLock) {
*** 733,742 ****
--- 731,743 ----
sm.checkConnect(isa.getAddress().getHostAddress(),
isa.getPort());
disconnect0(fd);
remoteAddress = null;
state = ST_UNCONNECTED;
+
+ // refresh local address
+ localAddress = Net.localAddress(fd);
}
}
}
return this;
}