Commit 2d4f9d83 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

Fix the Windows MPM. Windows doesn't always use the lingering close

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
parent 0e12ece9
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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);
+3 −0
Original line number Diff line number Diff line
@@ -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 */