mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8233002: Further enhance datagram socket support
Reviewed-by: alanb, chegar, dfuchs
This commit is contained in:
parent
c5f884c6d1
commit
34e36a8c01
4 changed files with 36 additions and 16 deletions
|
@ -127,7 +127,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
fd = new FileDescriptor();
|
||||
try {
|
||||
socketCreate(false);
|
||||
SocketCleanable.register(fd);
|
||||
SocketCleanable.register(fd, false);
|
||||
} catch (IOException ioe) {
|
||||
ResourceManager.afterUdpClose();
|
||||
fd = null;
|
||||
|
@ -136,7 +136,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
} else {
|
||||
fd = new FileDescriptor();
|
||||
socketCreate(true);
|
||||
SocketCleanable.register(fd);
|
||||
SocketCleanable.register(fd, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
} finally {
|
||||
releaseFD();
|
||||
}
|
||||
SocketCleanable.register(si.fd);
|
||||
SocketCleanable.register(si.fd, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -683,9 +683,6 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
protected void close() throws IOException {
|
||||
synchronized(fdLock) {
|
||||
if (fd != null) {
|
||||
if (!stream) {
|
||||
ResourceManager.afterUdpClose();
|
||||
}
|
||||
if (fdUseCount == 0) {
|
||||
if (closePending) {
|
||||
return;
|
||||
|
@ -840,7 +837,13 @@ abstract class AbstractPlainSocketImpl extends SocketImpl implements PlatformSoc
|
|||
*/
|
||||
protected void socketClose() throws IOException {
|
||||
SocketCleanable.unregister(fd);
|
||||
socketClose0(false);
|
||||
try {
|
||||
socketClose0(false);
|
||||
} finally {
|
||||
if (!stream) {
|
||||
ResourceManager.afterUdpClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract void socketCreate(boolean stream) throws IOException;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue