< prev index next >

src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java

Print this page

        

*** 444,453 **** --- 444,456 ---- } else if (name == StandardSocketOptions.SO_REUSEADDR) { setOption(SocketOptions.SO_REUSEADDR, value); } else if (name == StandardSocketOptions.SO_REUSEPORT) { setOption(SocketOptions.SO_REUSEPORT, value); } else if (name == StandardSocketOptions.SO_LINGER ) { + if (((Integer)value).intValue() < 0) + setOption(SocketOptions.SO_LINGER, false); + else setOption(SocketOptions.SO_LINGER, value); } else if (name == StandardSocketOptions.IP_TOS) { int i = ((Integer)value).intValue(); if (i < 0 || i > 255) throw new IllegalArgumentException("Invalid IP_TOS value: " + value);
*** 480,490 **** } else if (name == StandardSocketOptions.SO_REUSEADDR) { return (T)getOption(SocketOptions.SO_REUSEADDR); } else if (name == StandardSocketOptions.SO_REUSEPORT) { return (T)getOption(SocketOptions.SO_REUSEPORT); } else if (name == StandardSocketOptions.SO_LINGER) { ! return (T)getOption(SocketOptions.SO_LINGER); } else if (name == StandardSocketOptions.IP_TOS) { return (T)getOption(SocketOptions.IP_TOS); } else if (name == StandardSocketOptions.TCP_NODELAY) { return (T)getOption(SocketOptions.TCP_NODELAY); } else if (extendedOptions.isOptionSupported(name)) { --- 483,498 ---- } else if (name == StandardSocketOptions.SO_REUSEADDR) { return (T)getOption(SocketOptions.SO_REUSEADDR); } else if (name == StandardSocketOptions.SO_REUSEPORT) { return (T)getOption(SocketOptions.SO_REUSEPORT); } else if (name == StandardSocketOptions.SO_LINGER) { ! Object value = getOption(SocketOptions.SO_LINGER); ! if (value instanceof Boolean) { ! assert ((Boolean)value).booleanValue() == false; ! value = -1; ! } ! return (T)value; } else if (name == StandardSocketOptions.IP_TOS) { return (T)getOption(SocketOptions.IP_TOS); } else if (name == StandardSocketOptions.TCP_NODELAY) { return (T)getOption(SocketOptions.TCP_NODELAY); } else if (extendedOptions.isOptionSupported(name)) {
< prev index next >