changeset 49418:0ee57b9b376c

8200181: Remove superflous non-IPv4 code from Java_java_net_TwoStacksPlainSocketImpl_socketListen Reviewed-by: alanb
author chegar
date Fri, 23 Mar 2018 21:39:54 +0000
parents 2c3b9dbba7bc
children 1f14faf358fb
files src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c
diffstat 1 files changed, 5 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Tue Mar 20 04:36:44 2018 +0100
+++ b/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c	Fri Mar 23 21:39:54 2018 +0000
@@ -396,40 +396,21 @@
 {
     /* this FileDescriptor fd field */
     jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
-    jobject address;
     /* fdObj's int fd field */
-    int fd = INVALID_SOCKET;
-    SOCKETADDRESS addr;
-    int addrlen;
+    int fd;
 
     if (IS_NULL(fdObj)) {
         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
                         "socket closed");
         return;
+    } else {
+        fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
     }
 
-    if (!IS_NULL(fdObj)) {
-        fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
-    }
-    address = (*env)->GetObjectField(env, this, psi_addressID);
-    if (IS_NULL(address)) {
-        JNU_ThrowNullPointerException(env, "socket address");
-        return;
-    }
-    if (NET_InetAddressToSockaddr(env, address, 0, &addr, &addrlen,
-                                  JNI_FALSE) != 0) {
-        return;
+    if (listen(fd, count) == -1) {
+        NET_ThrowCurrent(env, "listen failed");
     }
 
-    if (addr.sa.sa_family == AF_INET) {
-        /* listen on v4 */
-        if (listen(fd, count) == -1) {
-            NET_ThrowCurrent(env, "listen failed");
-        }
-    } else {
-        NET_SocketClose(fd);
-        (*env)->SetObjectField(env, this, psi_fdID, NULL);
-    }
 }
 
 /*