< prev index next >
src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java
Print this page
@@ -25,10 +25,11 @@
package java.net;
import java.io.IOException;
import java.util.Set;
import java.util.HashSet;
+import java.util.Iterator;
import sun.net.ext.ExtendedSocketOptions;
/*
* On Unix systems we simply delegate to native methods.
*
@@ -83,14 +84,28 @@
}
}
protected Set<SocketOption<?>> supportedOptions() {
HashSet<SocketOption<?>> options = new HashSet<>(super.supportedOptions());
- options.addAll(extendedOptions.options());
+ options.addAll(filterSocketOption(extendedOptions.options()));
return options;
}
+ private Set<SocketOption<?>> filterSocketOption(Set<SocketOption<?>> options) {
+ Set<SocketOption<?>> opt = new HashSet<>(options);
+ final Iterator<SocketOption<?>> iterator = opt.iterator();
+ while (iterator.hasNext()) {
+ SocketOption<?> option = iterator.next();
+ // SO_QUICKACK is applicable for TCP Sockets only.
+ if (option.name().equals("SO_QUICKACK")) {
+ iterator.remove();
+ break;
+ }
+ }
+ return opt;
+ }
+
protected void socketSetOption(int opt, Object val) throws SocketException {
if (opt == SocketOptions.SO_REUSEPORT &&
!supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
throw new UnsupportedOperationException("unsupported option");
}
< prev index next >