Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2010-08-27 10:21:56 +0400
committerjfrijters <jfrijters>2010-08-27 10:21:56 +0400
commit663c7284c44161667671a330cd8233e45e329b59 (patch)
treea196a44c97275a0c53ace687445a46e1caff2686 /openjdk/sun/nio/ch
parent13955a090352de779a2bc53f147f6d626718b032 (diff)
Moved shared socket functionality from PlainSocketImpl.java to SocketUtil.java.
Diffstat (limited to 'openjdk/sun/nio/ch')
-rw-r--r--openjdk/sun/nio/ch/DatagramChannelImpl.java24
-rw-r--r--openjdk/sun/nio/ch/Net.java39
-rw-r--r--openjdk/sun/nio/ch/ServerSocketChannelImpl.java8
-rw-r--r--openjdk/sun/nio/ch/SocketChannelImpl.java6
4 files changed, 32 insertions, 45 deletions
diff --git a/openjdk/sun/nio/ch/DatagramChannelImpl.java b/openjdk/sun/nio/ch/DatagramChannelImpl.java
index 461a458c..bf722537 100644
--- a/openjdk/sun/nio/ch/DatagramChannelImpl.java
+++ b/openjdk/sun/nio/ch/DatagramChannelImpl.java
@@ -106,7 +106,7 @@ class DatagramChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
}
@@ -468,7 +468,7 @@ class DatagramChannelImpl
{
if (false) throw new cli.System.Net.Sockets.SocketException();
if (false) throw new cli.System.ObjectDisposedException("");
- fd.getSocket().Connect(PlainSocketImpl.getAddressFromInetAddress(isa.getAddress()), isa.getPort());
+ fd.getSocket().Connect(SocketUtil.getAddressFromInetAddress(isa.getAddress()), isa.getPort());
fd.getSocket().IOControl(SIO_UDP_CONNRESET, new byte[] { 1 }, null);
}
catch (cli.System.Net.Sockets.SocketException x)
@@ -618,7 +618,7 @@ class DatagramChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -637,7 +637,7 @@ class DatagramChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -667,7 +667,7 @@ class DatagramChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- if (x.get_ErrorCode() == Net.WSAECONNRESET)
+ if (x.get_ErrorCode() == SocketUtil.WSAECONNRESET)
{
// A previous send failed (i.e. the remote host responded with a ICMP that the port is closed) and
// the winsock stack helpfully lets us know this, but we only care about this when we're connected,
@@ -679,18 +679,18 @@ class DatagramChannelImpl
}
continue;
}
- if (x.get_ErrorCode() == Net.WSAEMSGSIZE)
+ if (x.get_ErrorCode() == SocketUtil.WSAEMSGSIZE)
{
// The buffer size was too small for the packet, ReceiveFrom receives the part of the packet
// that fits in the buffer and then throws an exception, so we have to ignore the exception in this case.
length = buf.length;
break;
}
- if (x.get_ErrorCode() == Net.WSAEWOULDBLOCK)
+ if (x.get_ErrorCode() == SocketUtil.WSAEWOULDBLOCK)
{
return IOStatus.UNAVAILABLE;
}
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -698,7 +698,7 @@ class DatagramChannelImpl
}
}
cli.System.Net.IPEndPoint ep = (cli.System.Net.IPEndPoint)remoteEP[0];
- addr = new InetSocketAddress(PlainSocketImpl.getInetAddressFromIPEndPoint(ep), ep.get_Port());
+ addr = new InetSocketAddress(SocketUtil.getInetAddressFromIPEndPoint(ep), ep.get_Port());
} while (remoteAddress != null && !addr.equals(remoteAddress));
sender = addr;
bb.put(buf, 0, length);
@@ -729,7 +729,7 @@ class DatagramChannelImpl
bb.get(buf);
bb.position(position);
}
- int sent = fd.getSocket().SendTo(buf, offset, length, cli.System.Net.Sockets.SocketFlags.wrap(cli.System.Net.Sockets.SocketFlags.None), new cli.System.Net.IPEndPoint(PlainSocketImpl.getAddressFromInetAddress(addr.getAddress()), addr.getPort()));
+ int sent = fd.getSocket().SendTo(buf, offset, length, cli.System.Net.Sockets.SocketFlags.wrap(cli.System.Net.Sockets.SocketFlags.None), new cli.System.Net.IPEndPoint(SocketUtil.getAddressFromInetAddress(addr.getAddress()), addr.getPort()));
if (bb.hasArray())
{
bb.position(position + sent);
@@ -742,11 +742,11 @@ class DatagramChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- if (x.get_ErrorCode() == Net.WSAEWOULDBLOCK)
+ if (x.get_ErrorCode() == SocketUtil.WSAEWOULDBLOCK)
{
return IOStatus.UNAVAILABLE;
}
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
diff --git a/openjdk/sun/nio/ch/Net.java b/openjdk/sun/nio/ch/Net.java
index af9c957c..8ba2807a 100644
--- a/openjdk/sun/nio/ch/Net.java
+++ b/openjdk/sun/nio/ch/Net.java
@@ -48,19 +48,6 @@ 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;
- static final int WSAENETUNREACH = 10051;
- static final int WSAECONNRESET = 10054;
- static final int WSAESHUTDOWN = 10058;
- static final int WSAETIMEDOUT = 10060;
- static final int WSAECONNREFUSED = 10061;
- static final int WSAEHOSTUNREACH = 10065;
- static final int WSAHOST_NOT_FOUND = 11001;
-
static FileDescriptor serverSocket(boolean stream) throws IOException
{
return socket(stream);
@@ -84,7 +71,7 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
}
@@ -94,11 +81,11 @@ class Net { // package-private
{
if (false) throw new cli.System.Net.Sockets.SocketException();
if (false) throw new cli.System.ObjectDisposedException("");
- fd.getSocket().Bind(new IPEndPoint(PlainSocketImpl.getAddressFromInetAddress(addr), port));
+ fd.getSocket().Bind(new IPEndPoint(SocketUtil.getAddressFromInetAddress(addr), port));
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -116,13 +103,13 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- if (x.get_ErrorCode() == WSAEINVAL)
+ if (x.get_ErrorCode() == SocketUtil.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);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException _)
{
@@ -137,7 +124,7 @@ class Net { // package-private
if (false) throw new cli.System.Net.Sockets.SocketException();
if (false) throw new cli.System.ObjectDisposedException("");
IPEndPoint ep = (IPEndPoint)fd.getSocket().get_LocalEndPoint();
- return new InetSocketAddress(PlainSocketImpl.getInetAddressFromIPEndPoint(ep), ep.get_Port());
+ return new InetSocketAddress(SocketUtil.getInetAddressFromIPEndPoint(ep), ep.get_Port());
}
catch (cli.System.Net.Sockets.SocketException x)
{
@@ -231,7 +218,7 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -257,7 +244,7 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -280,17 +267,17 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- if (x.get_ErrorCode() == PlainSocketImpl.WSAESHUTDOWN)
+ if (x.get_ErrorCode() == SocketUtil.WSAESHUTDOWN)
{
// the socket was shutdown, so we have to return EOF
return IOStatus.EOF;
}
- else if (x.get_ErrorCode() == PlainSocketImpl.WSAEWOULDBLOCK)
+ else if (x.get_ErrorCode() == SocketUtil.WSAEWOULDBLOCK)
{
// nothing to read and would block
return IOStatus.UNAVAILABLE;
}
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -372,11 +359,11 @@ class Net { // package-private
}
catch (cli.System.Net.Sockets.SocketException x)
{
- if (x.get_ErrorCode() == PlainSocketImpl.WSAEWOULDBLOCK)
+ if (x.get_ErrorCode() == SocketUtil.WSAEWOULDBLOCK)
{
return IOStatus.UNAVAILABLE;
}
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
diff --git a/openjdk/sun/nio/ch/ServerSocketChannelImpl.java b/openjdk/sun/nio/ch/ServerSocketChannelImpl.java
index 3819736a..82c921fa 100644
--- a/openjdk/sun/nio/ch/ServerSocketChannelImpl.java
+++ b/openjdk/sun/nio/ch/ServerSocketChannelImpl.java
@@ -319,7 +319,7 @@ class ServerSocketChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException _)
{
@@ -344,7 +344,7 @@ class ServerSocketChannelImpl
cli.System.Net.Sockets.Socket accsock = netSocket.Accept();
newfd.setSocket(accsock);
cli.System.Net.IPEndPoint ep = (cli.System.Net.IPEndPoint)accsock.get_RemoteEndPoint();
- isaa[0] = new InetSocketAddress(PlainSocketImpl.getInetAddressFromIPEndPoint(ep), ep.get_Port());
+ isaa[0] = new InetSocketAddress(SocketUtil.getInetAddressFromIPEndPoint(ep), ep.get_Port());
return 1;
}
else
@@ -354,7 +354,7 @@ class ServerSocketChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException _)
{
@@ -372,7 +372,7 @@ class ServerSocketChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
diff --git a/openjdk/sun/nio/ch/SocketChannelImpl.java b/openjdk/sun/nio/ch/SocketChannelImpl.java
index 32198bda..117161ea 100644
--- a/openjdk/sun/nio/ch/SocketChannelImpl.java
+++ b/openjdk/sun/nio/ch/SocketChannelImpl.java
@@ -856,7 +856,7 @@ class SocketChannelImpl
{
if (false) throw new cli.System.Net.Sockets.SocketException();
if (false) throw new cli.System.ObjectDisposedException("");
- cli.System.Net.IPEndPoint ep = new cli.System.Net.IPEndPoint(PlainSocketImpl.getAddressFromInetAddress(remote), remotePort);
+ cli.System.Net.IPEndPoint ep = new cli.System.Net.IPEndPoint(SocketUtil.getAddressFromInetAddress(remote), remotePort);
if (isBlocking())
{
fd.getSocket().Connect(ep);
@@ -918,7 +918,7 @@ class SocketChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{
@@ -936,7 +936,7 @@ class SocketChannelImpl
}
catch (cli.System.Net.Sockets.SocketException x)
{
- throw PlainSocketImpl.convertSocketExceptionToIOException(x);
+ throw SocketUtil.convertSocketExceptionToIOException(x);
}
catch (cli.System.ObjectDisposedException x1)
{