< prev index next >
src/java.base/unix/native/libnio/ch/Net.c
Print this page
rev 57580 : [mq]: MulticastSocketAdaptor
*** 585,594 ****
--- 585,601 ----
optval = (void*)&mreq_source;
optlen = sizeof(mreq_source);
}
n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen);
+ #ifdef __APPLE__
+ // workaround macOS bug where IP_ADD_MEMBERSHIP fails intermittently
+ if (n < 0 && errno == ENOMEM) {
+ n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen);
+ }
+ #endif
+
if (n < 0) {
if (join && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
return IOS_UNAVAILABLE;
handleSocketError(env, errno);
}
*** 655,664 ****
--- 662,678 ----
optlen = sizeof(req);
#endif
}
n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt, optval, optlen);
+ #ifdef __APPLE__
+ // workaround macOS bug where IPV6_ADD_MEMBERSHIP fails intermittently
+ if (n < 0 && errno == ENOMEM) {
+ n = setsockopt(fdval(env,fdo), IPPROTO_IPV6, opt, optval, optlen);
+ }
+ #endif
+
if (n < 0) {
if (join && (errno == ENOPROTOOPT || errno == EOPNOTSUPP))
return IOS_UNAVAILABLE;
handleSocketError(env, errno);
}
< prev index next >