< prev index next >
src/java.base/unix/classes/java/net/PlainSocketImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -26,11 +26,10 @@
import java.io.IOException;
import java.io.FileDescriptor;
import java.util.Set;
import java.util.HashSet;
-import java.util.Collections;
import jdk.net.*;
import static sun.net.ExtendedOptionsImpl.*;
/*
@@ -57,11 +56,17 @@
this.fd = fd;
}
protected <T> void setOption(SocketOption<T> name, T value) throws IOException {
if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+ if (!name.equals(ExtendedSocketOptions.SO_QUICKACK)) {
super.setOption(name, value);
+ } else if (isQuickAckAvailable()) {
+ setQuickAckOption(getFileDescriptor(), ((Boolean)value));
+ } else {
+ throw new UnsupportedOperationException("unsupported option");
+ }
} else {
if (getSocket() == null || !flowSupported()) {
throw new UnsupportedOperationException("unsupported option");
}
if (isClosedOrPending()) {
@@ -74,11 +79,17 @@
}
@SuppressWarnings("unchecked")
protected <T> T getOption(SocketOption<T> name) throws IOException {
if (!name.equals(ExtendedSocketOptions.SO_FLOW_SLA)) {
+ if (!name.equals(ExtendedSocketOptions.SO_QUICKACK)) {
return super.getOption(name);
+ } else if (isQuickAckAvailable()) {
+ return (T) getQuickAckOption(getFileDescriptor());
+ } else {
+ throw new UnsupportedOperationException("unsupported option");
+ }
}
if (getSocket() == null || !flowSupported()) {
throw new UnsupportedOperationException("unsupported option");
}
if (isClosedOrPending()) {
@@ -95,10 +106,13 @@
super.supportedOptions());
if (getSocket() != null && flowSupported()) {
options.add(ExtendedSocketOptions.SO_FLOW_SLA);
}
+ if (getSocket() != null && isQuickAckAvailable()) {
+ options.add(ExtendedSocketOptions.SO_QUICKACK);
+ }
return options;
}
protected void socketSetOption(int opt, boolean b, Object val) throws SocketException {
try {
< prev index next >