--- a/jdk/src/java.base/windows/native/libnet/net_util_md.c Fri Oct 17 10:59:32 2014 +0100
+++ b/jdk/src/java.base/windows/native/libnet/net_util_md.c Sun Oct 19 11:52:53 2014 +0100
@@ -29,6 +29,9 @@
#include "net_util.h"
#include "jni.h"
+// Taken from mstcpip.h in Windows SDK 8.0 or newer.
+#define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16)
+
#ifndef IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1e
#endif
@@ -844,6 +847,25 @@
}
}
+/**
+ * Enables SIO_LOOPBACK_FAST_PATH
+ */
+JNIEXPORT jint JNICALL
+NET_EnableFastTcpLoopback(int fd) {
+ int enabled = 1;
+ DWORD result_byte_count = -1;
+ int result = WSAIoctl(fd,
+ SIO_LOOPBACK_FAST_PATH,
+ &enabled,
+ sizeof(enabled),
+ NULL,
+ 0,
+ &result_byte_count,
+ NULL,
+ NULL);
+ return result == SOCKET_ERROR ? WSAGetLastError() : 0;
+}
+
/* If address types is IPv6, then IPv6 must be available. Otherwise
* no address can be generated. In the case of an IPv4 Inetaddress this
* method will return an IPv4 mapped address where IPv6 is available and