src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java
branchunixdomainchannels
changeset 58981 5c79956cc7d7
parent 58847 692de65ab293
child 58988 b88e23c84b23
--- a/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Tue Nov 05 18:34:02 2019 +0000
+++ b/src/java.base/unix/classes/sun/nio/ch/InheritedChannel.java	Fri Nov 08 09:46:55 2019 +0000
@@ -115,6 +115,21 @@
         }
     }
 
+    public static class InheritedUnixServerSocketChannelImpl extends UnixDomainServerSocketChannelImpl {
+
+        InheritedUnixServerSocketChannelImpl(SelectorProvider sp, FileDescriptor fd)
+            throws IOException
+        {
+            super(sp, fd, true);
+        }
+
+        @Override
+        protected void implCloseSelectableChannel() throws IOException {
+            super.implCloseSelectableChannel();
+            detachIOStreams();
+        }
+    }
+
     public static class InheritedInetServerSocketChannelImpl extends
         InetServerSocketChannelImpl {
 
@@ -214,8 +229,7 @@
                 if (isConnected(fdVal)) {
                     return new InheritedUnixSocketChannelImpl(provider, fd);
                 } else {
-                    // listener. unsupported.
-                    return null;
+                    return new InheritedUnixServerSocketChannelImpl(provider, fd);
                 }
             }
             InetAddress ia = peerAddress0(fdVal);