You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2004/12/11 10:45:07 UTC

svn commit: r111595 - /apr/apr/trunk/CHANGES /apr/apr/trunk/include/apr_network_io.h /apr/apr/trunk/network_io/unix/sockopt.c

Author: pquerna
Date: Sat Dec 11 01:45:06 2004
New Revision: 111595

URL: http://svn.apache.org/viewcvs?view=rev&rev=111595
Log:
Add support for Linux's TCP_DEFER_ACCEPT.  Sort of like FreeBSD's accept filters, except defer accept isn't documented, anywhere.

Modified:
   apr/apr/trunk/CHANGES
   apr/apr/trunk/include/apr_network_io.h
   apr/apr/trunk/network_io/unix/sockopt.c

Modified: apr/apr/trunk/CHANGES
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/CHANGES?view=diff&rev=111595&p1=apr/apr/trunk/CHANGES&r1=111594&p2=apr/apr/trunk/CHANGES&r2=111595
==============================================================================
--- apr/apr/trunk/CHANGES	(original)
+++ apr/apr/trunk/CHANGES	Sat Dec 11 01:45:06 2004
@@ -1,5 +1,8 @@
 Changes for APR 1.1.0
 
+  *) Add support for APR_TCP_DEFER_ACCEPT.
+     [Paul Querna]
+
   *) rename the apr_file_permissions defines (APR_UREAD,
      APR_UWRITE, etc.) to have prefix APR_FPROT_ (keeping the
      old defines) [Stas]

Modified: apr/apr/trunk/include/apr_network_io.h
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr_network_io.h?view=diff&rev=111595&p1=apr/apr/trunk/include/apr_network_io.h&r1=111594&p2=apr/apr/trunk/include/apr_network_io.h&r2=111595
==============================================================================
--- apr/apr/trunk/include/apr_network_io.h	(original)
+++ apr/apr/trunk/include/apr_network_io.h	Sat Dec 11 01:45:06 2004
@@ -94,6 +94,10 @@
 #define APR_IPV6_V6ONLY     16384 /**< Don't accept IPv4 connections on an
                                    * IPv6 listening socket.
                                    */
+#define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections 
+                                    * until data is available.
+                                    * @see apr_socket_accept_filter
+                                    */
 
 /** @} */
 

Modified: apr/apr/trunk/network_io/unix/sockopt.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/unix/sockopt.c?view=diff&rev=111595&p1=apr/apr/trunk/network_io/unix/sockopt.c&r1=111594&p2=apr/apr/trunk/network_io/unix/sockopt.c&r2=111595
==============================================================================
--- apr/apr/trunk/network_io/unix/sockopt.c	(original)
+++ apr/apr/trunk/network_io/unix/sockopt.c	Sat Dec 11 01:45:06 2004
@@ -199,6 +199,21 @@
         return APR_ENOTIMPL;
 #endif
         break;
+    case APR_TCP_DEFER_ACCEPT:
+#if defined(TCP_DEFER_ACCEPT)
+        if (apr_is_option_set(sock, APR_TCP_DEFER_ACCEPT) != on) {
+            int optlevel = IPPROTO_TCP;
+            int optname = TCP_DEFER_ACCEPT;
+
+            if (setsockopt(sock->socketdes, optlevel, optname, 
+                           (void *)&on, sizeof(int)) == -1) {
+                return errno;
+            }
+            apr_set_option(sock, APR_TCP_DEFER_ACCEPT, on);
+        }
+#else
+        return APR_ENOTIMPL;
+#endif
     case APR_TCP_NODELAY:
 #if defined(TCP_NODELAY)
         if (apr_is_option_set(sock, APR_TCP_NODELAY) != on) {