src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
changeset 50722 bc104aaf24e9
parent 47216 71c04702a3d5
child 50933 76b5ee99ffc0
equal deleted inserted replaced
50721:e541c1b68b89 50722:bc104aaf24e9
    30 import java.net.*;
    30 import java.net.*;
    31 import java.util.concurrent.*;
    31 import java.util.concurrent.*;
    32 import java.io.IOException;
    32 import java.io.IOException;
    33 import java.io.FileDescriptor;
    33 import java.io.FileDescriptor;
    34 import sun.net.NetHooks;
    34 import sun.net.NetHooks;
       
    35 import sun.net.util.SocketExceptions;
    35 import sun.security.action.GetPropertyAction;
    36 import sun.security.action.GetPropertyAction;
    36 
    37 
    37 /**
    38 /**
    38  * Unix implementation of AsynchronousSocketChannel
    39  * Unix implementation of AsynchronousSocketChannel
    39  */
    40  */
   256             e = x;
   257             e = x;
   257         } finally {
   258         } finally {
   258             end();
   259             end();
   259         }
   260         }
   260         if (e != null) {
   261         if (e != null) {
       
   262             if (e instanceof IOException) {
       
   263                 var isa = (InetSocketAddress)pendingRemote;
       
   264                 e = SocketExceptions.of((IOException)e, isa);
       
   265             }
   261             // close channel if connection cannot be established
   266             // close channel if connection cannot be established
   262             try {
   267             try {
   263                 close();
   268                 close();
   264             } catch (Throwable suppressed) {
   269             } catch (Throwable suppressed) {
   265                 e.addSuppressed(suppressed);
   270                 e.addSuppressed(suppressed);
   348             end();
   353             end();
   349         }
   354         }
   350 
   355 
   351         // close channel if connect fails
   356         // close channel if connect fails
   352         if (e != null) {
   357         if (e != null) {
       
   358             if (e instanceof IOException) {
       
   359                 e = SocketExceptions.of((IOException)e, isa);
       
   360             }
   353             try {
   361             try {
   354                 close();
   362                 close();
   355             } catch (Throwable suppressed) {
   363             } catch (Throwable suppressed) {
   356                 e.addSuppressed(suppressed);
   364                 e.addSuppressed(suppressed);
   357             }
   365             }