Commit ceca8bbf authored by Brian Pane's avatar Brian Pane
Browse files

Forward-port of the latest event MPM code from the 2.3-dev trunk into

the async-dev branch


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/async-dev@307334 13f79535-47bb-0310-9956-ffa450edef68
parent 6695d74c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line

LTLIBRARY_NAME    = libevent.la
LTLIBRARY_SOURCES = event.c event_filters.c fdqueue.c pod.c
LTLIBRARY_SOURCES = event.c fdqueue.c pod.c

include $(top_srcdir)/build/ltlib.mk
+6 −25
Original line number Diff line number Diff line
@@ -336,9 +336,6 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
    case AP_MPMQ_IS_ASYNC:
        *result = 1;
        return APR_SUCCESS;
    case AP_MPMQ_CUSTOM_WRITE:
        *result = 0;
        return APR_SUCCESS;
    case AP_MPMQ_HARD_LIMIT_DAEMONS:
        *result = server_limit;
        return APR_SUCCESS;
@@ -610,9 +607,8 @@ static int process_socket(apr_pool_t * p, apr_socket_t * sock,
         * accept() with a socket readability check, like Win32, 
         * and there are measurable delays before the
         * socket is readable due to the first data packet arriving,
         * it might be better to create the cs on the listener thread,
         * set the state to CONN_STATE_CHECK_REQUEST_LINE_READABLE,
         * and give it to the event thread.
         * it might be better to create the cs on the listener thread
         * with the state set to CONN_STATE_CHECK_REQUEST_LINE_READABLE
         *
         * FreeBSD users will want to enable the HTTP accept filter 
         * module in their kernel for the highest performance
@@ -663,13 +659,12 @@ static int process_socket(apr_pool_t * p, apr_socket_t * sock,
        cs->expiration_time = ap_server_conf->keep_alive_timeout + time_now;
        apr_thread_mutex_lock(timeout_mutex);
        APR_RING_INSERT_TAIL(&timeout_head, cs, conn_state_t, timeout_list);
        apr_thread_mutex_unlock(timeout_mutex);

        pt->status = 0;
        /* Add work to pollset. These are always read events */
        rc = apr_pollset_add(event_pollset, &cs->pfd);

        apr_thread_mutex_unlock(timeout_mutex);

        if (rc != APR_SUCCESS) {
            ap_log_error(APLOG_MARK, APLOG_ERR, rc, ap_server_conf,
                         "process_socket: apr_pollset_add failure");
@@ -833,16 +828,6 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
     */
#define TIMEOUT_FUDGE_FACTOR 100000

    /* POLLSET_SCALE_FACTOR * ap_threads_per_child sets the size of
     * the pollset.  I've seen 15 connections per active worker thread
     * running SPECweb99. 
     *
     * However, with the newer apr_pollset, this is the number of sockets that
     * we will return to any *one* call to poll().  Therefore, there is no
     * reason to make it more than ap_threads_per_child.
     */
#define POLLSET_SCALE_FACTOR 1

    rc = apr_thread_mutex_create(&timeout_mutex, APR_THREAD_MUTEX_DEFAULT,
                                 tpool);
    if (rc != APR_SUCCESS) {
@@ -857,7 +842,7 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)

    /* Create the main pollset */
    rc = apr_pollset_create(&event_pollset,
                            ap_threads_per_child * POLLSET_SCALE_FACTOR,
                            ap_threads_per_child,
                            tpool, APR_POLLSET_THREADSAFE);
    if (rc != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_ERR, rc, ap_server_conf,
@@ -945,13 +930,12 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
            }
            else {
                /* A Listener Socket is ready for an accept() */
                apr_pool_t *recycled_pool = NULL;

                lr = (ap_listen_rec *) pt->baton;

                ap_pop_pool(&recycled_pool, worker_queue_info);
                ap_pop_pool(&ptrans, worker_queue_info);

                if (recycled_pool == NULL) {
                if (ptrans == NULL) {
                    /* create a new transaction pool for each accepted socket */
                    apr_allocator_t *allocator;

@@ -968,9 +952,6 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
                        return NULL;
                    }
                }
                else {
                    ptrans = recycled_pool;
                }

                apr_pool_tag(ptrans, "transaction");

+0 −30
Original line number Diff line number Diff line
/* Copyright 2005 The Apache Software Foundation or its licensors, as
 * applicable.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "apr_buckets.h"
#include "apr_errno.h"
#include "apr_support.h"
#include "httpd.h"
#include "http_connection.h"
#include "util_filter.h"

apr_status_t ap_mpm_custom_write_filter(ap_filter_t *f,
                                        apr_bucket_brigade *bb)
{
    /* write you own C-O-F here */
    return ap_core_output_filter(f, bb);
}