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 proxy_util.c
Date Wed, 15 Sep 2004 12:20:19 GMT
mturk       2004/09/15 05:20:19

  Modified:    modules/proxy proxy_util.c
  Log:
  Fix worker retries and limit default retry timeout to 10 minutes.
  Thanks to Christian von Roques for spotting that.
  
  Revision  Changes    Path
  1.155     +11 -7     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.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- proxy_util.c	15 Sep 2004 11:57:02 -0000	1.154
  +++ proxy_util.c	15 Sep 2004 12:20:19 -0000	1.155
  @@ -1025,7 +1025,6 @@
                                                     const char *url)
   {
       char *c, *q, *uri = apr_pstrdup(p, url);
  -    apr_status_t rc = 0;
   
       c = strchr(uri, ':');   
       if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0')
  @@ -1042,10 +1041,10 @@
       (*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_runtime_worker));
       /* XXX Is this a right place to create mutex */
   #if APR_HAS_THREADS
  -    if ((rc = apr_thread_mutex_create(&((*balancer)->mutex),
  -                APR_THREAD_MUTEX_DEFAULT, p)) != APR_SUCCESS) {
  -            /* XXX: Do we need to log something here */
  -            return "can not create thread mutex";
  +    if (apr_thread_mutex_create(&((*balancer)->mutex),
  +                APR_THREAD_MUTEX_DEFAULT, p) != APR_SUCCESS) {
  +        /* XXX: Do we need to log something here */
  +        return "can not create thread mutex";
       }
   #endif
   
  @@ -1445,8 +1444,13 @@
                        proxy_function, worker->hostname);
           if (worker->retry)
               diff = worker->retry;
  -        else
  -            diff = apr_time_from_sec((60 + 60 * worker->retries++));
  +        else {
  +            /* Increase the time by 1 minute on each retry */
  +            diff = apr_time_from_sec((60 + 60 * worker->retries));
  +            /* Use 10 minutes as maximum value for retry */
  +            if (worker->retries < 8)
  +                ++worker->retries;
  +        }
           if (now > worker->error_time + diff) {
               worker->status &= ~PROXY_WORKER_IN_ERROR;
               ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
  
  
  

Mime
View raw message