Mercurial > hg > release > icedtea7-forest-2.5 > jdk
changeset 8236:cd8d4a478f35
8075738: Better multi-JVM sharing
Reviewed-by: michaelm
author | robm |
---|---|
date | Tue, 21 Apr 2015 20:58:31 +0100 |
parents | d8db6544b2a5 |
children | a8c6f2bc8e24 |
files | src/solaris/native/java/net/net_util_md.c |
diffstat | 1 files changed, 25 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/src/solaris/native/java/net/net_util_md.c Mon Jul 06 16:07:51 2015 +0100 +++ b/src/solaris/native/java/net/net_util_md.c Tue Apr 21 20:58:31 2015 +0100 @@ -1566,6 +1566,7 @@ int exclbind = -1; #endif int rv; + int arg, alen; #ifdef __linux__ /* @@ -1582,7 +1583,7 @@ } #endif -#if defined(__solaris__) && defined(AF_INET6) +#if defined(__solaris__) /* * Solaris has seperate IPv4 and IPv6 port spaces so we * use an exclusive bind when SO_REUSEADDR is not used to @@ -1592,35 +1593,31 @@ * results in a late bind that fails because the * corresponding IPv4 port is in use. */ - if (ipv6_available()) { - int arg, len; + alen = sizeof(arg); + if (useExclBind || getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, + (char *)&arg, &alen) == 0) { + if (useExclBind || arg == 0) { + /* + * SO_REUSEADDR is disabled or sun.net.useExclusiveBind + * property is true so enable TCP_EXCLBIND or + * UDP_EXCLBIND + */ + alen = sizeof(arg); + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg, + &alen) == 0) { + if (arg == SOCK_STREAM) { + level = IPPROTO_TCP; + exclbind = TCP_EXCLBIND; + } else { + level = IPPROTO_UDP; + exclbind = UDP_EXCLBIND; + } + } - len = sizeof(arg); - if (useExclBind || getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, - (char *)&arg, &len) == 0) { - if (useExclBind || arg == 0) { - /* - * SO_REUSEADDR is disabled or sun.net.useExclusiveBind - * property is true so enable TCP_EXCLBIND or - * UDP_EXCLBIND - */ - len = sizeof(arg); - if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&arg, - &len) == 0) { - if (arg == SOCK_STREAM) { - level = IPPROTO_TCP; - exclbind = TCP_EXCLBIND; - } else { - level = IPPROTO_UDP; - exclbind = UDP_EXCLBIND; - } - } - - arg = 1; - setsockopt(fd, level, exclbind, (char *)&arg, - sizeof(arg)); + arg = 1; + setsockopt(fd, level, exclbind, (char *)&arg, + sizeof(arg)); } - } } #endif