src/jdk.net/share/classes/jdk/net/Sockets.java
changeset 47733 fbfe06b70e16
parent 47216 71c04702a3d5
child 50303 7164c3bb55df
--- a/src/jdk.net/share/classes/jdk/net/Sockets.java	Fri Nov 10 03:27:43 2017 +0000
+++ b/src/jdk.net/share/classes/jdk/net/Sockets.java	Mon Nov 13 14:03:36 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -279,6 +279,9 @@
         if (flowsupported) {
             set.add(ExtendedSocketOptions.SO_FLOW_SLA);
         }
+        if (QuickAck.available) {
+            set.add(ExtendedSocketOptions.TCP_QUICKACK);
+        }
         set = Collections.unmodifiableSet(set);
         options.put(Socket.class, set);
 
@@ -290,6 +293,9 @@
         if (reuseportsupported) {
             set.add(StandardSocketOptions.SO_REUSEPORT);
         }
+        if (QuickAck.available) {
+            set.add(ExtendedSocketOptions.TCP_QUICKACK);
+        }
         set.add(StandardSocketOptions.IP_TOS);
         set = Collections.unmodifiableSet(set);
         options.put(ServerSocket.class, set);
@@ -331,4 +337,17 @@
 
         return Collections.unmodifiableMap(options);
     }
+
+    /**
+     * Tells whether TCP_QUICKACK is supported.
+     */
+    static class QuickAck {
+
+        static final boolean available;
+
+        static {
+            Set<SocketOption<?>> s = new Socket().supportedOptions();
+            available = s.contains(ExtendedSocketOptions.TCP_QUICKACK);
+        }
+    }
 }