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 proxy_util.c
Date Wed, 11 Aug 2004 22:27:34 GMT
wrowe       2004/08/11 15:27:34

  Modified:    modules/proxy mod_proxy.c mod_proxy.h proxy_util.c
  Log:
  Remove proxy_conn struct and add it's params to proxy_conn_rec.
  Use named structure type declarations.
  
  Submitted by: mturk
  
  Revision  Changes    Path
  1.117     +8 -8      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.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- mod_proxy.c	11 Aug 2004 22:16:27 -0000	1.116
  +++ mod_proxy.c	11 Aug 2004 22:27:33 -0000	1.117
  @@ -120,7 +120,7 @@
       return NULL;
   }
   
  -static const char *set_balancer_param(struct proxy_balancer *balancer,
  +static const char *set_balancer_param(proxy_balancer *balancer,
                                         const char *key,
                                         const char *val)
   {
  @@ -473,7 +473,7 @@
       int direct_connect = 0;
       const char *str;
       long maxfwd;
  -    struct proxy_balancer *balancer = NULL;
  +    proxy_balancer *balancer = NULL;
       proxy_worker *worker = NULL;
       proxy_module_conf *mconf;
   
  @@ -654,7 +654,7 @@
       ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry));
       ps->allowed_connect_ports = apr_array_make(p, 10, sizeof(int));
       ps->workers = apr_array_make(p, 10, sizeof(proxy_worker));
  -    ps->balancers = apr_array_make(p, 10, sizeof(struct proxy_balancer));
  +    ps->balancers = apr_array_make(p, 10, sizeof(proxy_balancer));
       ps->domain = NULL;
       ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
       ps->viaopt_set = 0; /* 0 means default */
  @@ -855,7 +855,7 @@
       elts = (const apr_table_entry_t *)arr->elts;
       /* Distinguish the balancer from woker */
       if (strncasecmp(r, "balancer:", 9) == 0) {
  -        struct proxy_balancer *balancer = ap_proxy_get_balancer(cmd->pool, conf, r);
  +        proxy_balancer *balancer = ap_proxy_get_balancer(cmd->pool, conf, r);
           if (!balancer) {
               const char *err = ap_proxy_add_balancer(&balancer,
                                                       cmd->pool,
  @@ -1203,7 +1203,7 @@
       server_rec *s = cmd->server;
       proxy_server_conf *conf =
       ap_get_module_config(s->module_config, &proxy_module);
  -    struct proxy_balancer *balancer;
  +    proxy_balancer *balancer;
       proxy_worker *worker;
       char *path = cmd->path;
       char *name = NULL;
  @@ -1279,7 +1279,7 @@
       server_rec *s = cmd->server;
       proxy_server_conf *conf =
       ap_get_module_config(s->module_config, &proxy_module);
  -    struct proxy_balancer *balancer;
  +    proxy_balancer *balancer;
       const char *name, *sticky;
   
       if (r != NULL && cmd->path == NULL ) {
  @@ -1540,14 +1540,14 @@
                                        url),DECLINED)
   APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, pre_request, (
                                         proxy_worker **worker,
  -                                      struct proxy_balancer **balancer,
  +                                      proxy_balancer **balancer,
                                         request_rec *r, 
                                         proxy_server_conf *conf,
                                         char **url),(worker,balancer,
                                         r,conf,url),DECLINED)
   APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, post_request,
                                         (proxy_worker *worker,
  -                                       struct proxy_balancer *balancer,
  +                                       proxy_balancer *balancer,
                                          request_rec *r,
                                          proxy_server_conf *conf),(worker,
                                          balancer,r,conf),DECLINED)
  
  
  
  1.104     +24 -20    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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- mod_proxy.h	11 Aug 2004 22:16:27 -0000	1.103
  +++ mod_proxy.h	11 Aug 2004 22:27:33 -0000	1.104
  @@ -173,6 +173,11 @@
   
   } proxy_server_conf;
   
  +typedef struct proxy_balancer  proxy_balancer;
  +typedef struct proxy_worker    proxy_worker;
  +typedef struct proxy_conn      proxy_conn;
  +typedef struct proxy_conn_pool proxy_conn_pool;
  +
   typedef struct {
       const char *p;            /* The path */
       int         p_is_fnmatch; /* Is this path an fnmatch candidate? */
  @@ -180,10 +185,16 @@
   } proxy_dir_conf;
   
   typedef struct {
  -    conn_rec *connection;
  -    char *hostname;
  -    apr_port_t port;
  -    int is_ssl;
  +    conn_rec     *connection;
  +    const char   *hostname;
  +    apr_port_t   port;
  +    int          is_ssl;
  +    apr_pool_t   *pool;     /* Subpool used for creating socket */
  +    apr_socket_t *sock;     /* Connection socket */
  +    apr_uint32_t flags;     /* Conection flags */
  +    int          close;     /* Close 'this' connection */
  +    proxy_worker *worker;   /* Connection pool this connection belogns to */
  +    void         *data;     /* per scheme connection data */
   } proxy_conn_rec;
   
   typedef struct {
  @@ -191,26 +202,18 @@
           int content_length; /* length of the content */
   } proxy_completion;
   
  -/* Physical connection to the backend server */
  -typedef struct {
  -    apr_pool_t   *pool; /* Subpool used for creating socket */
  -    apr_socket_t *sock;
  -    int          flags; /* 0: newly created 1: initialized -1: in error */
  -    int          close; /* Close 'this' connection */
  -} proxy_conn;
  -
   /* Connection pool */
  -typedef struct {
  +struct proxy_conn_pool {
       apr_pool_t     *pool;   /* The pool used in constructor and destructor calls */
       apr_sockaddr_t *addr;   /* Preparsed remote address info */
   #if APR_HAS_THREADS
       apr_reslist_t  *res;    /* Connection resource list */
   #endif
  -    proxy_conn     *conn;   /* Single connection for prefork mpm's */
  -} proxy_conn_pool;
  +    proxy_conn_rec *conn;   /* Single connection for prefork mpm's */
  +};
   
   /* Worker configuration */
  -typedef struct {
  +struct proxy_worker {
       int             status;
       apr_time_t      error_time; /* time of the last error */
       apr_interval_time_t retry;  /* retry interval */
  @@ -229,10 +232,11 @@
   
       proxy_conn_pool *cp;        /* Connection pool to use */
       void            *opaque;    /* per scheme worker data */
  -} proxy_worker;
  +};
   
   /* Runtime worker status informations. Shared in scoreboard */
   typedef struct {
  +    proxy_balancer  *b;         /* balancer containing this worker */
       proxy_worker    *w;
       double          lbfactor;   /* dynamic lbfactor */
       double          lbsatus;    /* Current lbstatus */
  @@ -352,9 +356,9 @@
   PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p, proxy_server_conf *conf,
const char *url);
   PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker, apr_pool_t *p, proxy_server_conf
*conf, const char *url);
   PROXY_DECLARE(struct proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p, proxy_server_conf
*conf, const char *url);
  -PROXY_DECLARE(const char *) ap_proxy_add_balancer(struct proxy_balancer **balancer, apr_pool_t
*p, proxy_server_conf *conf, const char *url);
  -PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer(struct proxy_balancer *balancer, proxy_worker
*worker);
  -PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, struct proxy_balancer **balancer,
request_rec *r, proxy_server_conf *conf, char **url);
  +PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer, apr_pool_t
*p, proxy_server_conf *conf, const char *url);
  +PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer(proxy_balancer *balancer, proxy_worker
*worker);
  +PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, proxy_balancer **balancer,
request_rec *r, proxy_server_conf *conf, char **url);
   PROXY_DECLARE(apr_status_t) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
proxy_server_conf *conf, proxy_module_conf *mconf,
                                                             apr_pool_t *ppool, apr_uri_t
*uri, char **url, const char *proxyname, apr_port_t proxyport,
                                                             char *server_portstr, int server_portstr_size);
  
  
  
  1.118     +14 -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.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- proxy_util.c	11 Aug 2004 22:15:23 -0000	1.117
  +++ proxy_util.c	11 Aug 2004 22:27:34 -0000	1.118
  @@ -988,11 +988,11 @@
       apr_table_add(t, key, value + offset);
   }
   
  -PROXY_DECLARE(struct proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
  -                                                             proxy_server_conf *conf,
  -                                                             const char *url)
  +PROXY_DECLARE(proxy_balancer *) ap_proxy_get_balancer(apr_pool_t *p,
  +                                                      proxy_server_conf *conf,
  +                                                      const char *url)
   {
  -    struct proxy_balancer *balancer;
  +    proxy_balancer *balancer;
       char *c, *uri = apr_pstrdup(p, url);
       int i;
       
  @@ -1002,7 +1002,7 @@
       /* remove path from uri */
       if ((c = strchr(c + 3, '/')))
           *c = '\0';
  -    balancer = (struct proxy_balancer *)conf->balancers->elts;
  +    balancer = (proxy_balancer *)conf->balancers->elts;
       for (i = 0; i < conf->balancers->nelts; i++) {
           if (strcasecmp(balancer->name, uri) == 0)
               return balancer;
  @@ -1011,7 +1011,7 @@
       return NULL;
   }
   
  -PROXY_DECLARE(const char *) ap_proxy_add_balancer(struct proxy_balancer **balancer,
  +PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
                                                     apr_pool_t *p,
                                                     proxy_server_conf *conf,
                                                     const char *url)
  @@ -1155,7 +1155,7 @@
   }
   
   PROXY_DECLARE(void) 
  -ap_proxy_add_worker_to_balancer(struct proxy_balancer *balancer, proxy_worker *worker)
  +ap_proxy_add_worker_to_balancer(proxy_balancer *balancer, proxy_worker *worker)
   {
       int i;
       double median, ffactor = 0.0;
  @@ -1202,7 +1202,7 @@
   }
   
   PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
  -                                        struct proxy_balancer **balancer,
  +                                        proxy_balancer **balancer,
                                           request_rec *r,
                                           proxy_server_conf *conf, char **url)
   {
  @@ -1226,7 +1226,7 @@
   }
   
   PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
  -                                         struct proxy_balancer *balancer,
  +                                         proxy_balancer *balancer,
                                            request_rec *r,
                                            proxy_server_conf *conf)
   {
  @@ -1315,7 +1315,7 @@
   
   static apr_status_t proxy_conn_cleanup(void *theconn)
   {
  -    proxy_conn *conn = (proxy_conn *)theconn;
  +    proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
       /* Close the socket */
       if (conn->sock)
           apr_socket_close(conn->sock);
  @@ -1328,7 +1328,7 @@
                                              apr_pool_t *pool)
   {
       apr_pool_t *ctx;
  -    proxy_conn *conn;
  +    proxy_conn_rec *conn;
       server_rec *s = (server_rec *)params;
       
       /* Create the subpool for each connection
  @@ -1336,7 +1336,7 @@
        * when disconnecting from backend.
        */
       apr_pool_create(&ctx, pool);
  -    conn = apr_pcalloc(ctx, sizeof(proxy_conn));
  +    conn = apr_pcalloc(ctx, sizeof(proxy_conn_rec));
   
       conn->pool = ctx;
       *resource = conn;
  @@ -1354,7 +1354,7 @@
   static apr_status_t connection_destructor(void *resource, void *params,
                                             apr_pool_t *pool)
   {
  -    proxy_conn *conn = (proxy_conn *)resource;
  +    proxy_conn_rec *conn = (proxy_conn_rec *)resource;
       server_rec *s = (server_rec *)params;
       
       apr_pool_destroy(conn->pool);
  @@ -1378,7 +1378,7 @@
       else
   #endif
       {
  -        worker->cp->conn = apr_pcalloc(worker->cp->pool, sizeof(proxy_conn));
  +        worker->cp->conn = apr_pcalloc(worker->cp->pool, sizeof(proxy_conn_rec));
           /* register the pool cleanup.
            * The cleanup is registered on conn_pool pool, so that
            * the same mechanism (apr_pool_cleanup) can be used
  
  
  

Mime
View raw message