diff options
author | jfrijters <jfrijters> | 2007-07-20 19:10:38 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2007-07-20 19:10:38 +0400 |
commit | 97fbf77df5c83f75ef8facd66760ff6bc092971a (patch) | |
tree | 7d67d2e9a39737e0817dd98c16440b8896a28759 /openjdk/sun/nio/ch/Net.java | |
parent | 10a9e24f6787b08c62e8c83b75691227d874f2a7 (diff) |
Restructured to reduce the number of differences with OpenJDK sources.
Diffstat (limited to 'openjdk/sun/nio/ch/Net.java')
-rw-r--r-- | openjdk/sun/nio/ch/Net.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/openjdk/sun/nio/ch/Net.java b/openjdk/sun/nio/ch/Net.java index 9736586c..ba907756 100644 --- a/openjdk/sun/nio/ch/Net.java +++ b/openjdk/sun/nio/ch/Net.java @@ -49,6 +49,7 @@ class Net { // package-private private Net() { } // Winsock Error Codes + static final int WSAEINVAL = 10022; static final int WSAEWOULDBLOCK = 10035; static final int WSAEMSGSIZE = 10040; static final int WSAEADDRINUSE = 10048; @@ -60,13 +61,18 @@ class Net { // package-private static final int WSAEHOSTUNREACH = 10065; static final int WSAHOST_NOT_FOUND = 11001; - static FileDescriptor socket(boolean streaming) throws IOException + static FileDescriptor serverSocket(boolean stream) throws IOException + { + return socket(stream); + } + + static FileDescriptor socket(boolean stream) throws IOException { try { if (false) throw new cli.System.Net.Sockets.SocketException(); FileDescriptor fd = new FileDescriptor(); - if (streaming) + if (stream) { fd.setSocket(new cli.System.Net.Sockets.Socket(AddressFamily.wrap(AddressFamily.InterNetwork), SocketType.wrap(SocketType.Stream), ProtocolType.wrap(ProtocolType.Tcp))); } @@ -110,6 +116,12 @@ class Net { // package-private } catch (cli.System.Net.Sockets.SocketException x) { + if (x.get_ErrorCode() == WSAEINVAL) + { + // Work around for winsock issue. You can't set a socket to blocking if a connection request is pending, + // so we'll have to set the blocking again in SocketChannelImpl.checkConnect(). + return; + } throw PlainSocketImpl.convertSocketExceptionToIOException(x); } catch (cli.System.ObjectDisposedException _) |