httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r377780 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Date Tue, 14 Feb 2006 17:35:39 GMT
Author: jim
Date: Tue Feb 14 09:35:36 2006
New Revision: 377780

URL: http://svn.apache.org/viewcvs?rev=377780&view=rev
Log:
OK, handle better the initializing of worker, separating
"shared" and "local" inits, and being aware that if the
shared aspects are initialized, this doesn't mean
the local ones are :)

Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=377780&r1=377779&r2=377780&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Feb 14 09:35:36 2006
@@ -1570,6 +1570,11 @@
 }
 #endif
 
+/*
+ * ap_proxy_initialize_worker_share() concerns itself
+ * with initializing those parts of worker which
+ * are, or could be, shared. Basically worker->s
+ */
 PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf,
                                                      proxy_worker *worker,
                                                      server_rec *s)
@@ -1593,23 +1598,34 @@
         score = ap_get_scoreboard_lb(worker->id);
         if (!score) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
-                  "proxy: ap_get_scoreboard_lb(%d) failed for worker %s",
-                  worker->id, worker->name);
+                  "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for
worker %s",
+                  worker->id, getpid(), worker->name);
         }
         else {
              ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-                  "proxy: initialized scoreboard slot %d for worker %s",
-                  worker->id, worker->name);
+                  "proxy: grabbed scoreboard slot %d in child %" APR_PID_T_FMT " for worker
%s",
+                  worker->id, getpid(), worker->name);
         }
     }
 #endif
     if (!score) {
         score = apr_pcalloc(conf->pool, sizeof(proxy_worker_stat));
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-              "proxy: initialized plain memory for worker %s",
-              worker->name);
+              "proxy: initialized plain memory in child %" APR_PID_T_FMT " for worker %s",
+              getpid(), worker->name);
     }
     worker->s = (proxy_worker_stat *)score;
+    /*
+     * recheck to see if we've already been here. Possible
+     * if proxy is using scoreboard to hold shared stats
+     */
+    if (worker->s->status & PROXY_WORKER_INITIALIZED) {
+        /* The worker share is already initialized */
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+              "proxy: worker %s already initialized",
+              worker->name);
+        return;
+    }
     if (worker->route)
         strcpy(worker->s->route, worker->route);
     else
@@ -1618,11 +1634,8 @@
         strcpy(worker->s->redirect, worker->redirect);
     else
         *worker->s->redirect = '\0';
-    /* Set default parameters */
-    if (!worker->retry)
-        worker->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
-    /* By default address is reusable */
-    worker->is_address_reusable = 1;
+
+    worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED);
 
 }
 
@@ -1634,11 +1647,17 @@
     int mpm_threads;
 #endif
 
-    if (worker->s->status & PROXY_WORKER_INITIALIZED) {
+    if (worker->status & PROXY_WORKER_INITIALIZED) {
         /* The worker is already initialized */
         return APR_SUCCESS;
     }
 
+    /* Set default parameters */
+    if (!worker->retry)
+        worker->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
+    /* By default address is reusable */
+    worker->is_address_reusable = 1;
+
 #if APR_HAS_THREADS
     ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
     if (mpm_threads > 1) {
@@ -1686,8 +1705,9 @@
              "proxy: initialized single connection worker %d in child %" APR_PID_T_FMT "
for (%s)",
              worker->id, getpid(), worker->hostname);
     }
-    if (rv == APR_SUCCESS)
-        worker->s->status |= (worker->status | PROXY_WORKER_INITIALIZED);
+    if (rv == APR_SUCCESS) {
+        worker->status |= (PROXY_WORKER_INITIALIZED);
+    }
     return rv;
 }
 



Mime
View raw message