httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy mod_proxy.c mod_proxy.h
Date Wed, 11 Aug 2004 21:27:57 GMT
wrowe       2004/08/11 14:27:57

  Modified:    modules/proxy mod_proxy.c mod_proxy.h
  Log:
  Move min,smax and hmax params to worker, so they can be set
  before the connection pool is created
  
  Added init_conn_pool to worker.
  Connection pool will either use reslist (if thread number > 1)  or single connection.
  
  Submitted by: mturk
  
  Revision  Changes    Path
  1.107     +36 -0     httpd-2.0/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.c,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- mod_proxy.c	11 Aug 2004 21:26:03 -0000	1.106
  +++ mod_proxy.c	11 Aug 2004 21:27:57 -0000	1.107
  @@ -20,6 +20,7 @@
   #include "mod_core.h"
   
   #include "apr_optional.h"
  +#include "ap_mpm.h"
   
   #if (MODULE_MAGIC_NUMBER_MAJOR > 20020903)
   #include "mod_ssl.h"
  @@ -1366,6 +1367,39 @@
       return NULL;
   }
   
  +static void init_conn_pool(apr_pool_t *p, proxy_worker *worker)
  +{
  +    apr_pool_t *pool;
  +    proxy_conn_pool *cp;
  +    
  +    /* Create a connection pool's subpool */
  +    apr_pool_create(&pool, p);
  +    cp = (proxy_conn_pool *)apr_pcalloc(pool, sizeof(proxy_conn_pool));
  +    cp->pool = pool;
  +#if APR_HAS_THREADS
  +    {
  +        int mpm_threads;
  +        ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
  +        if (mpm_threads > 1) {
  +            /* Set hard max to no more then mpm_threads */
  +            if (worker->hmax == 0 || worker->hmax > mpm_threads)
  +                 worker->hmax = mpm_threads;
  +            if (worker->smax == 0 || worker->smax > worker->hmax)
  +                 worker->smax = worker->hmax;
  +            /* Set min to be lower then smax */
  +            if (worker->min > worker->smax)
  +                 worker->min = worker->smax; 
  +        }
  +        else {
  +            /* This will supress the apr_reslist creation */
  +            worker->min = worker->smax = worker->hmax = 0;
  +        }
  +    }
  +#endif
  +    
  +    worker->cp = cp;
  +}
  +
   PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
                                                   apr_pool_t *p,
                                                   proxy_server_conf *conf,
  @@ -1398,6 +1432,8 @@
       if (port == -1)
           port = apr_uri_port_of_scheme((*worker)->scheme);
       (*worker)->port = port;
  +
  +    init_conn_pool(p, *worker);
   
       return NULL;
   }
  
  
  
  1.96      +3 -3      httpd-2.0/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.h,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- mod_proxy.h	11 Aug 2004 21:25:15 -0000	1.95
  +++ mod_proxy.h	11 Aug 2004 21:27:57 -0000	1.96
  @@ -202,9 +202,6 @@
   typedef struct {
       apr_pool_t     *pool;   /* The pool used in constructor and destructor calls */
       apr_sockaddr_t *addr;   /* Preparsed remote address info */
  -    int            min;     /* Desired minimum number of available connections */
  -    int            smax;    /* Soft maximum on the total number of connections */
  -    int            hmax;    /* Hard maximum on the total number of connections */
   #if APR_HAS_THREADS
       apr_reslist_t  *res;    /* Connection resource list */
   #else
  @@ -223,6 +220,9 @@
       const char      *scheme;    /* scheme to use ajp|http|https */
       const char      *hostname;  /* remote backend address */
       apr_port_t      port;
  +    int             min;        /* Desired minimum number of available connections */
  +    int             smax;       /* Soft maximum on the total number of connections */
  +    int             hmax;       /* Hard maximum on the total number of connections */
       proxy_conn_pool *cp;        /* Connection pool to use */
       void            *opaque;    /* per scheme worker data */
   } proxy_worker;
  
  
  

Mime
View raw message