]> granicus.if.org Git - apache/commitdiff
Fix the Windows MPM. Windows doesn't always use the lingering close
authorRyan Bloom <rbb@apache.org>
Sat, 10 Nov 2001 21:07:13 +0000 (21:07 +0000)
committerRyan Bloom <rbb@apache.org>
Sat, 10 Nov 2001 21:07:13 +0000 (21:07 +0000)
function. If it can re-use the socket, we are better off not calling
the function.  To fix this, we re-expose the lingering_close function,
and we allow the MPM to remove the cleanup.

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

include/http_connection.h
server/connection.c
server/mpm/winnt/mpm_winnt.c

index 4abad5ce08669997bb1b584f4ee7364dcbcb8816..ae00cfd7fafb4dd51bf211ae1e37640900a39a66 100644 (file)
@@ -88,6 +88,22 @@ 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
+ */
+apr_status_t ap_lingering_close(void *dummy);
 #endif
 
   /* Hooks */
index eba68b65106b918cd0db12d110d744fd0486ed96..f03917e4e5c1748a5372ef3bd31a1dcadf9bc093 100644 (file)
@@ -149,7 +149,7 @@ 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
-static apr_status_t ap_lingering_close(void *dummy)
+apr_status_t ap_lingering_close(void *dummy)
 {
     char dummybuf[512];
     apr_size_t nbytes = sizeof(dummybuf);
index daa97247106eed0284dbd4b78b6b07ea21450f96..b6b7d7d6686ce99bf26f5b53553868b0a988b14d 100644 (file)
@@ -902,6 +902,9 @@ static void worker_main(int thread_num)
             if (!disconnected) {
                 context->accept_socket = INVALID_SOCKET;
             }
+            else {
+                apr_pool_cleanup_kill(context->ptrans, c, ap_lingering_close);
+            }
         }
         else {
             /* ap_new_connection closes the socket on failure */