After integrating the fix for JDK-8198358 there are only a few
differences left in these two implementations, so it is relatively easy
to merge them together.
Some cleanup was done along the way:
- unused argument in socket0() was removed,
- tests of the IP family were moved from native code to Java layer,
- SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, FALSE)
was removed from socket0 (as it is already done inside NET_Socket()),
- if (WSAGetLastError() == -2) branch removed from accept0(), as it can
never succeed anyway (in TwoStacks it was testing for newfd == -2, which
doesn't seem correct either),
- in accept0() added a check if (*env)->NewObject() was unsuccessful.
Also a regression test was added to verify that bind() and connect()
reject Inet6Address when the system option java.net.preferIPv4Stack is
set to true.
The patched JDK was successfully built and all the tests, including the
new one, passed well.
The new test also passed well on all other platforms.
Would you please help review the fix?
Thanks in advance!
With kind regards,