You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Ames <gr...@raleigh.ibm.com> on 2000/07/17 20:52:54 UTC

[PATCH] ap_sock_disable_nagle is a no-op

ap_sock_disable_nagle is a no-op when it shouldn't be, because TCP_NODELAY isn't
necessarily defined when mpm_common.h is #include'd.  (neat trick to turn the header into
a no-op though :-)

Once this is resolved, the ap_sock_disable_nagle code in mpm_common.c needs to use a
function that actually exists to set TCP_NODELAY.

Tested on prefork & mpmt_pthread, with my ap_sendfile patch on first.

Index: include/mpm_common.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/include/mpm_common.h,v
retrieving revision 1.5
diff -u -d -b -r1.5 mpm_common.h
--- mpm_common.h        2000/07/10 22:08:07     1.5
+++ mpm_common.h        2000/07/14 21:38:45
@@ -74,6 +74,10 @@
 extern "C" {
 #endif
 
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>    /* for TCP_NODELAY */
+#endif
+        
 void ap_reclaim_child_processes(int terminate);
 void ap_wait_or_timeout(ap_wait_t *status, ap_proc_t *ret, ap_pool_t *p);
 void ap_process_child_status(ap_proc_t *pid, ap_wait_t status);
Index: main/mpm_common.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/main/mpm_common.c,v
retrieving revision 1.23
diff -u -d -b -r1.23 mpm_common.c
--- mpm_common.c        2000/07/11 22:12:15     1.23
+++ mpm_common.c        2000/07/14 21:47:32
@@ -290,7 +290,8 @@
      */
     int just_say_no = 1;
 
-    if (ap_setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
+    /* XXX APR-ize me! */
+    if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
                    sizeof(int)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                     "setsockopt: (TCP_NODELAY)");