]> granicus.if.org Git - apache/commitdiff
Remove ap_lingering_close from all of the MPMs. This is now done as
authorRyan Bloom <rbb@apache.org>
Sat, 10 Nov 2001 18:26:30 +0000 (18:26 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 10 Nov 2001 18:26:30 +0000 (18:26 +0000)
a cleanup registered with the connection_pool.  I have also turned
ap_lingering_close into a static function, because it is only used
in connection.c.  This is the next step to consolidating all of the
socket function calls.  ap_lingering_close will only be added if the
core is dealing with a standard socket.

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

12 files changed:
include/http_connection.h
server/connection.c
server/mpm/beos/beos.c
server/mpm/experimental/perchild/perchild.c
server/mpm/mpmt_os2/mpmt_os2_child.c
server/mpm/netware/mpm_netware.c
server/mpm/perchild/perchild.c
server/mpm/prefork/prefork.c
server/mpm/spmt_os2/spmt_os2.c
server/mpm/threaded/threaded.c
server/mpm/winnt/mpm_winnt.c
server/mpm/worker/worker.c

index 37fcba7fab2bf60c9c2d0c96bb9d611e550a3f7c..4abad5ce08669997bb1b584f4ee7364dcbcb8816 100644 (file)
@@ -88,22 +88,6 @@ AP_CORE_DECLARE(void) ap_process_connection(conn_rec *);
 
 AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
 
-/**
- * This function is responsible for the following cases:
- * <pre>
- * we now proceed to read from the client until we get EOF, or until
- * MAX_SECS_TO_LINGER has passed.  the reasons for doing this are
- * documented in a draft:
- *
- * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
- *
- * in a nutshell -- if we don't make this effort we risk causing
- * TCP RST packets to be sent which can tear down a connection before
- * all the response data has been sent to the client.
- * </pre>
- * @param c The connection we are closing
- */
-void ap_lingering_close(conn_rec *);
 #endif
 
   /* Hooks */
index 5356c7bd47474518254dd4f8297e0c09613e008d..eba68b65106b918cd0db12d110d744fd0486ed96 100644 (file)
@@ -149,13 +149,14 @@ AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c)
  * all the response data has been sent to the client.
  */
 #define SECONDS_TO_LINGER  2
-void ap_lingering_close(conn_rec *c)
+static apr_status_t ap_lingering_close(void *dummy)
 {
     char dummybuf[512];
     apr_size_t nbytes = sizeof(dummybuf);
     apr_status_t rc;
     apr_int32_t timeout;
     apr_int32_t total_linger_time = 0;
+    conn_rec *c = dummy;
 
     ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_CLOSING, NULL);
 
@@ -175,7 +176,7 @@ void ap_lingering_close(conn_rec *c)
 
     if (c->aborted) {
         apr_socket_close(c->client_socket);
-        return;
+        return APR_SUCCESS;
     }
 
     /* Shut down the socket for write, which will send a FIN
@@ -185,7 +186,7 @@ void ap_lingering_close(conn_rec *c)
     if (apr_shutdown(c->client_socket, APR_SHUTDOWN_WRITE) != APR_SUCCESS || 
         c->aborted) {
         apr_socket_close(c->client_socket);
-        return;
+        return APR_SUCCESS;
     }
 
     /* Read all data from the peer until we reach "end-of-file" (FIN
@@ -208,6 +209,7 @@ void ap_lingering_close(conn_rec *c)
     }
 
     apr_socket_close(c->client_socket);
+    return APR_SUCCESS;
 }
 
 AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c)
@@ -262,5 +264,7 @@ AP_CORE_DECLARE(conn_rec *)ap_new_connection(apr_pool_t *p, server_rec *server,
 
     conn->id = id;
 
+    apr_pool_cleanup_register(p, conn, ap_lingering_close, apr_pool_cleanup_null);
+
     return conn;
 }
index a872b7654f9c1174aa27e876290ef4f4ab6223fd..7e43f56ef67f5637cad13381e9b94b4116d6186b 100644 (file)
@@ -316,7 +316,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num)
 
     if (current_conn) {
         ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
     }
 }
 
index f2cb943ee7185f80430fbe8085808e4773035660..2a8cbe6ba4283b5e480fd6e28cfbbbf6c002b5c8 100644 (file)
@@ -505,7 +505,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
     current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id);
     if (current_conn) {
         ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
     }
 }
 
index e9cfcecbe8f3860d8a9fad203120f97ebcac36d2..2694a75091607b6f19c057ecc5aed4f0922a0f0e 100644 (file)
@@ -411,7 +411,6 @@ static void worker_main(void *vpArg)
 
         if (current_conn) {
             ap_process_connection(current_conn);
-            ap_lingering_close(current_conn);
         }
 
         apr_pool_destroy(pconn);
index d91237d29ce4021ff5ee00750fe1386417e049d6..705948dbceeca18839d1a6553e510780290995dc 100644 (file)
@@ -509,7 +509,6 @@ got_listener:
         current_conn = ap_new_connection(ptrans, ap_server_conf, csd, my_worker_num);
         if (current_conn) {
             ap_process_connection(current_conn);
-            ap_lingering_close(current_conn);
         }
         
     }
index f2cb943ee7185f80430fbe8085808e4773035660..2a8cbe6ba4283b5e480fd6e28cfbbbf6c002b5c8 100644 (file)
@@ -505,7 +505,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id)
     current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id);
     if (current_conn) {
         ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
     }
 }
 
index 3ae850b7ef0c03de72f5f3a89eded65628ffa47a..656b0cabf327c870f73ef2d7590673ff8119bdcb 100644 (file)
@@ -792,7 +792,6 @@ static void child_main(int child_num_arg)
                                          my_child_num);
         if (current_conn) {
             ap_process_connection(current_conn);
-            ap_lingering_close(current_conn);
         }
         
         /* Check the pod after processing a connection so that we'll go away
index 3deba5a6b4566b1b852aa87f6f31c3b987eb6f3d..8a99733d853705242f82e52947fa6f36a3d22a55 100644 (file)
@@ -685,7 +685,6 @@ static void thread_main(void *thread_num_arg)
 
         if (current_conn) {
             ap_process_connection(current_conn);
-            ap_lingering_close(current_conn);
         }
     }
 
index 7818daae9e99d1e233f5822bfe23bf96de158331..f0dd4cc13465135882375a4ca5fd43c1b8ffe9a8 100644 (file)
@@ -478,7 +478,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
     current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id);
     if (current_conn) {
         ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
     }
 }
 
index 2f25b1ce66f12c9d394d9da48d2a94473a91acb3..daa97247106eed0284dbd4b78b6b07ea21450f96 100644 (file)
@@ -901,7 +901,6 @@ static void worker_main(int thread_num)
             apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected);
             if (!disconnected) {
                 context->accept_socket = INVALID_SOCKET;
-                ap_lingering_close(c);
             }
         }
         else {
index 4e15eaa3e6a6e01e3e43afe4d8b4ea31756d4d38..0ea7ae6d8fda8f6fa7dcca53d9327a382f56a165 100644 (file)
@@ -502,7 +502,6 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
     current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id);
     if (current_conn) {
         ap_process_connection(current_conn);
-        ap_lingering_close(current_conn);
     }
 }