tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/ajp/proxy mod_proxy.c mod_proxy.h
Date Thu, 05 Aug 2004 16:55:34 GMT
mturk       2004/08/05 09:55:34

  Modified:    ajp/proxy mod_proxy.c mod_proxy.h
  Log:
  Added iobuffersize and receivebuffersize to be worker specific.
  As for timeout their default value is from proxy_conf.
  
  Revision  Changes    Path
  1.27      +36 -14    jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/mod_proxy.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_proxy.c	5 Aug 2004 16:27:06 -0000	1.26
  +++ mod_proxy.c	5 Aug 2004 16:55:34 -0000	1.27
  @@ -72,6 +72,16 @@
   }
   #endif
   
  +#define PROXY_COPY_CONF_PARAMS(w, c) \
  +    do {                             \
  +        (w)->timeout              = (c)->timeout;               \
  +        (w)->timeout_set          = (c)->timeout_set;           \
  +        (w)->recv_buffer_size     = (c)->recv_buffer_size;      \
  +        (w)->recv_buffer_size_set = (c)->recv_buffer_size_set;  \
  +        (w)->io_buffer_size       = (c)->io_buffer_size;        \
  +        (w)->io_buffer_size_set   = (c)->io_buffer_size_set;    \
  +    } while (0)
  +
   static const char *set_worker_param(proxy_worker *worker,
                                       const char *key,
                                       const char *val)
  @@ -81,53 +91,66 @@
       if (!strcasecmp(key, "loadfactor")) {
           worker->lbfactor = atoi(val);
           if (worker->lbfactor < 1 || worker->lbfactor > 100)
  -            return "loadfactor must be number between 1..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";
  +            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 at least one second";
  +            return "TTL must be at 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";
  +            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";
  +            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";
  +            return "Smax must be a positive number";
           worker->smax = ival;
       }
       else if (!strcasecmp(key, "acquire")) {
           ival = atoi(val);
           if (ival < 1)
  -            return "acquire must be at least one mili second";
  +            return "Acquire must be at least one mili second";
           worker->acquire = apr_time_make(0, ival * 1000);
           worker->acquire_set = 1;
  -     }
  +    }
       else if (!strcasecmp(key, "timeout")) {
           ival = atoi(val);
           if (ival < 1)
  -            return "timeout must be at least one second";
  +            return "Timeout must be at least one second";
           worker->timeout = apr_time_from_sec(ival);
           worker->timeout_set = 1;
  -     }
  +    }
  +    else if (!strcasecmp(key, "iobuffersize")) {
  +        long s = atol(val);
  +        worker->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
  +        worker->io_buffer_size_set = 1;
  +    }
  +    else if (!strcasecmp(key, "receivebuffersize")) {
  +        ival = atoi(val);
  +        if (ival < 512 && ival != 0) {
  +            return "ReceiveBufferSize must be >= 512 bytes, or 0 for system default.";
  +        }
  +        worker->recv_buffer_size = ival;
  +        worker->recv_buffer_size_set = 1;
  +    }
       else {
           return "unknown parameter";
       }
  @@ -866,8 +889,8 @@
               if (err)
                   return apr_pstrcat(cmd->temp_pool, "ProxyPass: ", err, NULL);
           }
  -        if (conf->timeout_set)
  -            worker->timeout = conf->timeout;
  +        PROXY_COPY_CONF_PARAMS(worker, conf);
  +
           for (i = 0; i < arr->nelts; i++) {
               const char *err = set_worker_param(worker, elts[i].key, elts[i].val);
               if (err)
  @@ -1238,8 +1261,7 @@
           if ((err = ap_proxy_add_worker(&worker, cmd->pool, conf, name)) != NULL)
               return apr_pstrcat(cmd->temp_pool, "BalancerMember: ", err, NULL); 
       }
  -    if ((worker->timeout_set = conf->timeout_set))
  -        worker->timeout = conf->timeout;
  +    PROXY_COPY_CONF_PARAMS(worker, conf);
       
       arr = apr_table_elts(params);
       elts = (const apr_table_entry_t *)arr->elts;
  
  
  
  1.19      +6 -2      jakarta-tomcat-connectors/ajp/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/mod_proxy.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_proxy.h	5 Aug 2004 16:24:48 -0000	1.18
  +++ mod_proxy.h	5 Aug 2004 16:55:34 -0000	1.19
  @@ -155,7 +155,7 @@
       int preserve_host;
       int preserve_host_set;
       apr_interval_time_t timeout;
  -    int timeout_set;
  +    char timeout_set;
       enum {
         bad_error,
         bad_ignore,
  @@ -228,9 +228,13 @@
       apr_interval_time_t ttl;    /* maximum amount of time in seconds a connection
                                    * may be available while exceeding the soft limit */
       apr_interval_time_t timeout; /* connection timeout */
  -    int timeout_set;
  +    char                timeout_set;
       apr_interval_time_t acquire; /* acquire timeout when the maximum number of connections
is exceeded */
       char                acquire_set;
  +    apr_size_t          recv_buffer_size;
  +    char                recv_buffer_size_set;
  +    apr_size_t          io_buffer_size;
  +    char                io_buffer_size_set;
       proxy_conn_pool *cp;        /* Connection pool to use */
       void            *opaque;    /* per scheme worker data */
   };
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message