summaryrefslogtreecommitdiff
path: root/external/ikvm/openjdk/java/net/PlainSocketImpl.java
diff options
context:
space:
mode:
authorJo Shields <directhex@apebox.org>2014-02-19 22:12:43 +0000
committerJo Shields <directhex@apebox.org>2014-02-19 22:12:43 +0000
commit9972bf87b4f27d9c8f358ef8414ac1ab957a2f0f (patch)
tree5bb230c1d698659115f918e243c1d4b0aa4c7f51 /external/ikvm/openjdk/java/net/PlainSocketImpl.java
parentd0a215f5626219ff7927f576588a777e5331c7be (diff)
downloadmono-upstream/3.2.8+dfsg.tar.gz
Imported Upstream version 3.2.8+dfsgupstream/3.2.8+dfsg
Diffstat (limited to 'external/ikvm/openjdk/java/net/PlainSocketImpl.java')
-rw-r--r--external/ikvm/openjdk/java/net/PlainSocketImpl.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/external/ikvm/openjdk/java/net/PlainSocketImpl.java b/external/ikvm/openjdk/java/net/PlainSocketImpl.java
index d67825bc61..5b7f850d18 100644
--- a/external/ikvm/openjdk/java/net/PlainSocketImpl.java
+++ b/external/ikvm/openjdk/java/net/PlainSocketImpl.java
@@ -54,6 +54,12 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
/* If the version supports a dual stack TCP implementation */
private static boolean useDualStackImpl = false;
+ /* sun.net.useExclusiveBind */
+ private static String exclBindProp;
+
+ /* True if exclusive binding is on for Windows */
+ private static boolean exclusiveBind = true;
+
static {
java.security.AccessController.doPrivileged( new PrivilegedAction<Object>() {
public Object run() {
@@ -62,6 +68,7 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
version = Float.parseFloat(System.getProperties().getProperty("os.version"));
preferIPv4Stack = Boolean.parseBoolean(
System.getProperties().getProperty("java.net.preferIPv4Stack"));
+ exclBindProp = System.getProperty("sun.net.useExclusiveBind");
} catch (NumberFormatException e ) {
assert false : e;
}
@@ -84,7 +91,15 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
// (version >= 6.0) implies Vista or greater.
if (version >= 6.0 && !preferIPv4Stack) {
- useDualStackImpl = true;
+ useDualStackImpl = true;
+ }
+
+ if (exclBindProp != null) {
+ // sun.net.useExclusiveBind is true
+ exclusiveBind = exclBindProp.length() == 0 ? true
+ : Boolean.parseBoolean(exclBindProp);
+ } else if (version < 6.0) {
+ exclusiveBind = false;
}
}
@@ -93,9 +108,9 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
*/
PlainSocketImpl() {
if (useDualStackImpl) {
- impl = new DualStackPlainSocketImpl();
+ impl = new DualStackPlainSocketImpl(exclusiveBind);
} else {
- impl = new TwoStacksPlainSocketImpl();
+ impl = new TwoStacksPlainSocketImpl(exclusiveBind);
}
}
@@ -104,9 +119,9 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
*/
PlainSocketImpl(FileDescriptor fd) {
if (useDualStackImpl) {
- impl = new DualStackPlainSocketImpl(fd);
+ impl = new DualStackPlainSocketImpl(fd, exclusiveBind);
} else {
- impl = new TwoStacksPlainSocketImpl(fd);
+ impl = new TwoStacksPlainSocketImpl(fd, exclusiveBind);
}
}