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:29:57 GMT
wrowe       2004/08/11 14:29:57

  Modified:    modules/proxy mod_proxy.c mod_proxy.h
  Log:
  Move worker params parsing to a separate function.
  The same will be used for creating ProxyPass connection pools.
  
  Added ttl param to worker for maintaining reslist.
  
  Submitted by: mturk
  
  Revision  Changes    Path
  1.108     +49 -11    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.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- mod_proxy.c	11 Aug 2004 21:27:57 -0000	1.107
  +++ mod_proxy.c	11 Aug 2004 21:29:57 -0000	1.108
  @@ -73,6 +73,52 @@
   }
   #endif
   
  +static const char *set_worker_param(proxy_worker *worker,
  +                                    const char *key,
  +                                    const char *val)
  +{
  +
  +    int ival;
  +    if (!strcasecmp(key, "loadfactor")) {
  +        worker->lbfactor = atoi(val);
  +        if (worker->lbfactor < 1 || worker->lbfactor > 100)
  +            return "loadfactor must be number between 1..100";
  +    }
  +    else if (!strcasecmp(key, "retry")) {
  +        ival = atoi(val);
  +        if (ival < 1)
  +            return "retry must be al least one second";
  +        worker->retry = apr_time_from_sec(ival);
  +    }
  +    else if (!strcasecmp(key, "ttl")) {
  +        ival = atoi(val);
  +        if (ival < 1)
  +            return "ttl must be al least one second";
  +        worker->ttl = apr_time_from_sec(ival);
  +    }
  +    else if (!strcasecmp(key, "min")) {
  +        ival = atoi(val);
  +        if (ival < 0)
  +            return "min must be a positive number";
  +        worker->min = ival;
  +    }
  +    else if (!strcasecmp(key, "max")) {
  +        ival = atoi(val);
  +        if (ival < 0)
  +            return "max must be a positive number";
  +        worker->hmax = ival;
  +    }
  +    /* XXX: More inteligent naming needed */
  +    else if (!strcasecmp(key, "smax")) {
  +        ival = atoi(val);
  +        if (ival < 0)
  +            return "smax must be a positive number";
  +        worker->smax = ival;
  +    }
  +
  +    return NULL;
  +}
  +
   static int alias_match(const char *uri, const char *alias_fakename)
   {
       const char *end_fakename = alias_fakename + strlen(alias_fakename);
  @@ -1080,17 +1126,9 @@
       arr = apr_table_elts(params);
       elts = (const apr_table_entry_t *)arr->elts;
       for (i = 0; i < arr->nelts; i++) {
  -        if (!strcasecmp(elts[i].key, "loadfactor")) {
  -            worker->lbfactor = atoi(elts[i].val);
  -            if (worker->lbfactor < 1 || worker->lbfactor > 100)
  -                return "BalancerMember: loadfactor must be number between 1..100";
  -        }
  -        else if (!strcasecmp(elts[i].key, "retry")) {
  -            int sec = atoi(elts[i].val);
  -            if (sec < 0)
  -                return "BalancerMember: retry must be positive number";
  -            worker->retry = apr_time_from_sec(sec);
  -        }
  +        const char *err = set_worker_param(worker, elts[i].key, elts[i].val);
  +        if (err)
  +            return apr_pstrcat(cmd->temp_pool, "BalancerMember: ", err, NULL);
       }
       /* Try to find the balancer */
       balancer = ap_proxy_get_balancer(cmd->temp_pool, conf, name); 
  
  
  
  1.97      +2 -0      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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- mod_proxy.h	11 Aug 2004 21:27:57 -0000	1.96
  +++ mod_proxy.h	11 Aug 2004 21:29:57 -0000	1.97
  @@ -223,6 +223,8 @@
       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 */
  +    apr_interval_time_t ttl;    /* maximum amount of time in seconds a connection
  +                                 * may be available while exceeding the soft limit */
       proxy_conn_pool *cp;        /* Connection pool to use */
       void            *opaque;    /* per scheme worker data */
   } proxy_worker;
  
  
  

Mime
View raw message