httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy mod_proxy.c proxy_util.c mod_proxy.h
Date Fri, 10 Sep 2004 18:29:16 GMT
mturk       2004/09/10 11:29:16

  Modified:    modules/proxy mod_proxy.c proxy_util.c mod_proxy.h
  Log:
  Just like for balancers initialize the workers on post_config
  instead on first request to skip the race condition.
  
  Revision  Changes    Path
  1.140     +12 -1     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.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- mod_proxy.c	9 Sep 2004 13:15:40 -0000	1.139
  +++ mod_proxy.c	10 Sep 2004 18:29:16 -0000	1.140
  @@ -1349,7 +1349,6 @@
       }
       /* Add the worker to the load balancer */
       ap_proxy_add_worker_to_balancer(cmd->pool, balancer, worker);
  -
       return NULL;
   }
   
  @@ -1596,8 +1595,20 @@
   static int proxy_post_config(apr_pool_t *pconf, apr_pool_t *plog,
                                apr_pool_t *ptemp, server_rec *s)
   {
  +    proxy_server_conf *conf =
  +    (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
  +    proxy_worker *worker;
  +    int i;
  +
       proxy_ssl_enable = APR_RETRIEVE_OPTIONAL_FN(ssl_proxy_enable);
       proxy_ssl_disable = APR_RETRIEVE_OPTIONAL_FN(ssl_engine_disable);
  +
  +    /* Initialize all the workers */
  +    worker = (proxy_worker *)conf->workers->elts;
  +    for (i = 0; i < conf->workers->nelts; i++) {
  +        ap_proxy_initialize_worker(worker, s);
  +        worker++;
  +    }
   
       return OK;
   }
  
  
  
  1.146     +4 -14     httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.145
  retrieving revision 1.146
  diff -u -r1.145 -r1.146
  --- proxy_util.c	10 Sep 2004 14:32:11 -0000	1.145
  +++ proxy_util.c	10 Sep 2004 18:29:16 -0000	1.146
  @@ -1377,7 +1377,7 @@
       return connection_destructor(conn, NULL, NULL);
   }
   
  -static apr_status_t init_conn_worker(proxy_worker *worker, server_rec *s)
  +PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, server_rec
*s)
   {
       apr_status_t rv;
   
  @@ -1420,13 +1420,13 @@
   #endif
       {
           
  -        connection_constructor((void **)&(worker->cp->conn), s, worker->cp->pool);
  -        rv = APR_SUCCESS;
  +        rv = connection_constructor((void **)&(worker->cp->conn), s, worker->cp->pool);
           ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
                        "proxy: initialized single connection worker for (%s)",
                         worker->hostname);
       }
  -
  +    if (rv == APR_SUCCESS)
  +        worker->status |= PROXY_WORKER_INITIALIZED;
       return rv;
   }
   
  @@ -1464,16 +1464,6 @@
                                                  server_rec *s)
   {
       apr_status_t rv;
  -
  -    if (!(worker->status & PROXY_WORKER_INITIALIZED)) {
  -        if ((rv = init_conn_worker(worker, s)) != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
  -                         "proxy: %s: failed to initialize worker for (%s)",
  -                         proxy_function, worker->hostname);
  -            return HTTP_INTERNAL_SERVER_ERROR;
  -        }
  -        worker->status |= PROXY_WORKER_INITIALIZED;
  -    }
   
       if (!PROXY_WORKER_IS_USABLE(worker)) {
           /* Retry the worker */
  
  
  
  1.130     +10 -1     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.129
  retrieving revision 1.130
  diff -u -r1.129 -r1.130
  --- mod_proxy.h	10 Sep 2004 08:16:25 -0000	1.129
  +++ mod_proxy.h	10 Sep 2004 18:29:16 -0000	1.130
  @@ -282,7 +282,6 @@
   } proxy_runtime_worker;
   
   struct proxy_balancer {
  -    int                status;
       apr_array_header_t *workers; /* array of proxy_runtime_workers */
       const char *name;            /* name of the load balancer */
       const char *sticky;          /* sticky session identifier */
  @@ -409,6 +408,16 @@
                                                   apr_pool_t *p,
                                                   proxy_server_conf *conf,
                                                   const char *url);
  +
  +/**
  + * Initize the worker
  + * @param worker the new worker
  + * @param p      memory pool to allocate worker from 
  + * @param s      current server record
  + * @return       APR_SUCCESS or error code
  + */
  +PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker,
  +                                                       server_rec *s);
   /**
    * Get the balancer from proxy configuration
    * @param p     memory pool used for finding balancer
  
  
  

Mime
View raw message