]> granicus.if.org Git - apache/commitdiff
APRize disabling nagle (setting TCP_NODELAY).
authorBrian Havard <bjh@apache.org>
Tue, 22 Aug 2000 15:09:28 +0000 (15:09 +0000)
committerBrian Havard <bjh@apache.org>
Tue, 22 Aug 2000 15:09:28 +0000 (15:09 +0000)
Note that several areas have not been tested as they apply to MPMs or APR
code that I can't test.

PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86133 13f79535-47bb-0310-9956-ffa450edef68

include/mpm_common.h
server/mpm/dexter/dexter.c
server/mpm/experimental/perchild/perchild.c
server/mpm/mpmt_pthread/mpmt_pthread.c
server/mpm/perchild/perchild.c
server/mpm/prefork/prefork.c
server/mpm_common.c

index 2eb8ecbc028b5c67f0e788d0fb6dc2eb14e71c2f..dc96d38f496d8359284ae212edecd31c497c4546 100644 (file)
@@ -123,7 +123,7 @@ void ap_process_child_status(apr_proc_t *pid, apr_wait_t status);
  * Nagle's algorithm that have severe performance penalties.
  * @param s The socket to disable nagle for.
  */
-void ap_sock_disable_nagle(int s);
+void ap_sock_disable_nagle(apr_socket_t *s);
 #else
 #define ap_sock_disable_nagle(s)        /* NOOP */
 #endif
index ecaa711b3ad86fab3d46a8e2223bd6bab23c9965..664e8f03d13afd218fcb03e9f9ca6ad6a38c5dde 100644 (file)
@@ -416,7 +416,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
         return;
     }
 
-    ap_sock_disable_nagle(csd);
+    ap_sock_disable_nagle(sock);
     iol = ap_iol_attach_socket(p, sock);
     conn_io = ap_bcreate(p, B_RDWR);
     ap_bpush_iol(conn_io, iol);
index c18e50ad7bfc14313100e715dd1b9517a0f13b35..ab3a0cbd574d1fc070936087a8215339af7f1bfa 100644 (file)
@@ -453,7 +453,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
     }
 
     if (thread_socket_table[thread_num] < 0) {
-        ap_sock_disable_nagle(csd);
+        ap_sock_disable_nagle(sock);
     }
     iol = ap_iol_attach_socket(p, sock);
     conn_io = ap_bcreate(p, B_RDWR);
index 68307a7fdc907e8369dbcaa031780096782120e4..ad3ca6d8425229744c476ba53fae6dfff21b392d 100644 (file)
@@ -411,7 +411,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
         return;
     }
 
-    ap_sock_disable_nagle(csd);
+    ap_sock_disable_nagle(sock);
 
     iol = ap_iol_attach_socket(p, sock);
 
index c18e50ad7bfc14313100e715dd1b9517a0f13b35..ab3a0cbd574d1fc070936087a8215339af7f1bfa 100644 (file)
@@ -453,7 +453,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
     }
 
     if (thread_socket_table[thread_num] < 0) {
-        ap_sock_disable_nagle(csd);
+        ap_sock_disable_nagle(sock);
     }
     iol = ap_iol_attach_socket(p, sock);
     conn_io = ap_bcreate(p, B_RDWR);
index 8cd351281ddbeecb7bf5bad46a685958c8c30bd3..64cffcaa197a4f09a53465e3fe84007a9a69c47e 100644 (file)
@@ -1020,7 +1020,7 @@ static void child_main(int child_num_arg)
            continue;
 #endif
 
-       ap_sock_disable_nagle(sockdes);
+       ap_sock_disable_nagle(csd);
 
        iol = ap_iol_attach_socket(ptrans, csd);
        (void) ap_update_child_status(my_child_num, SERVER_BUSY_READ,
index 6cc477cd60adc17d7bff932898b9253babf6e094..d77c66244092a3e3604a98939c916b26fc81f134 100644 (file)
@@ -261,7 +261,7 @@ void ap_process_child_status(apr_proc_t *pid, apr_wait_t status)
 }
 
 #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF)
-void ap_sock_disable_nagle(int s)
+void ap_sock_disable_nagle(apr_socket_t *s)
 {
     /* The Nagle algorithm says that we should delay sending partial
      * packets in hopes of getting more data.  We don't want to do
@@ -272,11 +272,10 @@ void ap_sock_disable_nagle(int s)
      *
      * In spite of these problems, failure here is not a shooting offense.
      */
-    int just_say_no = 1;
+    apr_status_t status = apr_setsocketopt(s, APR_TCP_NODELAY, 1);
 
-    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,
+    if (status != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_WARNING, status, ap_server_conf,
                     "setsockopt: (TCP_NODELAY)");
     }
 }