src/share/classes/sun/nio/ch/Net.java

Print this page
rev 9687 : * * *

*** 25,39 **** --- 25,41 ---- package sun.nio.ch; import java.io.*; import java.net.*; + import jdk.net.*; import java.nio.channels.*; import java.util.*; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; + import sun.net.ExtendedOptionsImpl; public class Net { private Net() { }
*** 295,304 **** --- 297,316 ---- if (value == null) throw new IllegalArgumentException("Invalid option value"); // only simple values supported by this method Class<?> type = name.type(); + + if (type == SocketFlow.class) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new NetworkPermission("setOption.SO_FLOW_SLA")); + } + ExtendedOptionsImpl.setFlowOption(fd, (SocketFlow)value); + return; + } + if (type != Integer.class && type != Boolean.class) throw new AssertionError("Should not reach here"); // special handling if (name == StandardSocketOptions.SO_RCVBUF ||
*** 347,356 **** --- 359,378 ---- SocketOption<?> name) throws IOException { Class<?> type = name.type(); + if (type == SocketFlow.class) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new NetworkPermission("getOption.SO_FLOW_SLA")); + } + SocketFlow flow = SocketFlow.create(); + ExtendedOptionsImpl.getFlowOption(fd, flow); + return flow; + } + // only simple values supported by this method if (type != Integer.class && type != Boolean.class) throw new AssertionError("Should not reach here"); // map option name to platform level/name