httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r426708 - in /httpd/httpd/branches/httpd-proxy-scoreboard: modules/mem/ modules/proxy/ support/
Date Fri, 28 Jul 2006 23:37:16 GMT
Author: jfclere
Date: Fri Jul 28 16:37:15 2006
New Revision: 426708

URL: http://svn.apache.org/viewvc?rev=426708&view=rev
Log:
Arrange the warning. Thanks Jim.

Added:
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.h
Modified:
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/mod_sharedmem.c
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.c
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h
    httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c
    httpd/httpd/branches/httpd-proxy-scoreboard/support/proxymonitor.c

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/mod_sharedmem.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/mod_sharedmem.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/mod_sharedmem.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/mod_sharedmem.c Fri Jul 28 16:37:15
2006
@@ -28,6 +28,7 @@
 #include "http_log.h"
 
 #include  "slotmem.h"
+#include "sharedmem_util.h"
 
 /* make sure the shared memory is cleaned */
 static int initialize_cleanup(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
@@ -45,7 +46,7 @@
 
 static void ap_sharedmem_register_hook(apr_pool_t *p)
 {
-    slotmem_storage_method *storage = sharedmem_getstorage();
+    const slotmem_storage_method *storage = sharedmem_getstorage();
     ap_register_provider(p, SLOTMEM_STORAGE, "shared", "0", storage);
     ap_hook_post_config(initialize_cleanup, NULL, NULL, APR_HOOK_LAST);
     ap_hook_pre_config(pre_config, NULL, NULL, APR_HOOK_MIDDLE);

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.c Fri Jul 28 16:37:15
2006
@@ -20,6 +20,7 @@
 #define CORE_PRIVATE
 
 #include "apr.h"
+#include "apr_strings.h"
 #include "apr_pools.h"
 #include "apr_shm.h"
 
@@ -27,7 +28,8 @@
 #include "http_config.h"
 #include "http_log.h"
 
-#include  "slotmem.h"
+#include "slotmem.h"
+#include "sharedmem_util.h"
 
 /* The description of the slots to reuse the slotmem */
 struct sharedslotdesc {
@@ -230,7 +232,7 @@
 };
 
 /* make the storage usuable from outside */
-slotmem_storage_method *sharedmem_getstorage()
+const slotmem_storage_method *sharedmem_getstorage()
 {
     return(&storage);
 }

Added: httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.h?rev=426708&view=auto
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.h (added)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/mem/sharedmem_util.h Fri Jul 28 16:37:15
2006
@@ -0,0 +1,20 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Memory handler for a shared memory divided in slot.
+ * This one uses shared memory.
+ */
+const slotmem_storage_method *sharedmem_getstorage();

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/health_checker_util.c Fri Jul
28 16:37:15 2006
@@ -130,7 +130,7 @@
     return sizeof(struct proxy_worker_conf);
 }
 /* copy the worker information in the shared area so the health-checker can extract the part
it need */
-static apr_status_t add_entry(proxy_worker *worker, char *balancer_name, int id)
+static apr_status_t add_entry(proxy_worker *worker, const char *balancer_name, int id)
 {
     struct proxy_worker_conf *workerconf = NULL;
     apr_status_t rv;
@@ -216,6 +216,7 @@
 static apr_status_t get_entry(int id, proxy_worker **worker, char **balancer_name, apr_pool_t
*pool)
 {
     struct proxy_worker_conf *workerconf = NULL;
+    char *ptr;
     apr_status_t rv;
 
     if (myscore == NULL)
@@ -227,7 +228,7 @@
     /* allocate the data */
     *worker = apr_pcalloc(pool, sizeof(proxy_worker));
     if (workerconf->balancer_name)
-        *balancer_name = apr_pcalloc(pool, strlen(workerconf->balancer_name));
+        *balancer_name = apr_pcalloc(pool, strlen(workerconf->balancer_name) + 1);
     else
         *balancer_name = NULL;
 
@@ -236,16 +237,31 @@
     // XXX: what to do (* worker)->s = workerconf;
     (* worker)->retry = workerconf->retry;
     (* worker)->lbfactor = workerconf->lbfactor;
-    if (workerconf->name)
-        strcpy((* worker)->name, workerconf->name);
-    if (workerconf->scheme)
-        strcpy((* worker)->scheme, workerconf->scheme);
-    if (workerconf->hostname)
-        strcpy((* worker)->hostname, workerconf->hostname);
-    if (workerconf->route)
-        strcpy((* worker)->route, workerconf->route);
-    if (workerconf->redirect)
-        strcpy((* worker)->redirect, workerconf->redirect);
+    if (workerconf->name) {
+        ptr = apr_pcalloc(pool, strlen(workerconf->name) + 1);
+        strcpy(ptr, workerconf->name);
+        (* worker)->name = ptr;
+    }
+    if (workerconf->scheme) {
+        ptr = apr_pcalloc(pool, strlen(workerconf->scheme) + 1);
+        strcpy(ptr, workerconf->scheme);
+        (* worker)->scheme = ptr;
+    }
+    if (workerconf->hostname) {
+        ptr = apr_pcalloc(pool, strlen(workerconf->hostname) + 1);
+        strcpy(ptr, workerconf->hostname);
+        (* worker)->hostname = ptr;
+    }
+    if (workerconf->route) {
+        ptr = apr_pcalloc(pool, strlen(workerconf->route) + 1);
+        strcpy(ptr, workerconf->route);
+        (* worker)->route = ptr;
+    }
+    if (workerconf->redirect) {
+        ptr = apr_pcalloc(pool, strlen(workerconf->redirect) + 1);
+        strcpy(ptr, workerconf->redirect);
+        (* worker)->redirect = ptr;
+    }
     (* worker)->status = workerconf->status;
     (* worker)->port = workerconf->port;
     (* worker)->min = workerconf->min;
@@ -272,7 +288,7 @@
 
     if (myscore == NULL)
         return APR_ENOSHMAVAIL;
-    rv = checkstorage->ap_slotmem_mem(myscore, id, workerconf);
+    rv = checkstorage->ap_slotmem_mem(myscore, id, (void **) workerconf);
     if (rv != APR_SUCCESS)
         return rv;
     *balancer_name = (*workerconf)->balancer_name;
@@ -286,7 +302,7 @@
 
     if (myscore == NULL)
         return APR_ENOSHMAVAIL;
-    rv = checkstorage->ap_slotmem_mem(myscore, id, &workerconf);
+    rv = checkstorage->ap_slotmem_mem(myscore, id, (void **) &workerconf);
     if (rv != APR_SUCCESS)
         return rv;
     /* If the error is not initialized to the worker to be removed keep it */
@@ -321,17 +337,17 @@
 };
 
 /* make the module usuable from outside */
-health_worker_method *health_checker_get_storage()
+const health_worker_method *health_checker_get_storage()
 {
     return(&worker_storage);
 }
 
 /* handle the slotmem storage */
-void health_checker_init_slotmem_storage(slotmem_storage_method * storage)
+void health_checker_init_slotmem_storage(const slotmem_storage_method * storage)
 {
     checkstorage = storage;
 }
-slotmem_storage_method * health_checker_get_slotmem_storage()
+const slotmem_storage_method * health_checker_get_slotmem_storage()
 {
     return(checkstorage);
 }

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h Fri Jul 28 16:37:15
2006
@@ -446,6 +446,10 @@
 
 /* proxy_util.c */
 
+PROXY_DECLARE(void) proxy_checkstorage_add_entry(proxy_worker *worker, const char *balancer_name);
+PROXY_DECLARE(void) proxy_create_comarea(apr_pool_t *pconf);
+PROXY_DECLARE(void) proxy_lookup_storage_provider();
+
 PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
 PROXY_DECLARE(int) ap_proxy_hex2c(const char *x);
 PROXY_DECLARE(void) ap_proxy_c2hex(int ch, char *x);
@@ -715,6 +719,7 @@
  */
 PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
                                            apr_bucket_brigade *brigade);
+
 
 /* Scoreboard */
 #if MODULE_MAGIC_NUMBER_MAJOR > 20020903

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c Fri
Jul 28 16:37:15 2006
@@ -18,7 +18,7 @@
                               apr_pool_t *ptemp)
 {
     slotmem_storage_method *checkstorage;
-    health_worker_method *worker_storage = health_checker_get_storage();
+    const health_worker_method *worker_storage = health_checker_get_storage();
     ap_slotmem_t *myscore;
     
     checkstorage = ap_lookup_provider(SLOTMEM_STORAGE, "shared", "0");
@@ -51,15 +51,11 @@
 
 static void ap_healthstore_register_hook(apr_pool_t *p)
 {
-    static const char * const aszPre[] = { "mod_proxy.c", NULL };
     static const char * const aszPos[] = { "mod_sharedmem.c", NULL };
 
-    health_worker_method *worker_storage = health_checker_get_storage();
+    const health_worker_method *worker_storage = health_checker_get_storage();
     ap_register_provider(p, PROXY_CKMETHOD, "default", "0", worker_storage);
     ap_hook_pre_config(healthck_pre_config, NULL, aszPos, APR_HOOK_MIDDLE);
-    /* XXX: Too late....
-    ap_hook_post_config(healthck_post_config, aszPre, NULL, APR_HOOK_MIDDLE);
-     */
 }
 
 module AP_MODULE_DECLARE_DATA proxy_health_checker_module = {

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.h Fri
Jul 28 16:37:15 2006
@@ -29,9 +29,9 @@
 /* allow health check method on workers in a non httpd process */
 struct health_worker_method {
     /* read the size of the entry: to create the shared area */
-    int (* getentrysize)();
+    int (* getentrysize)(void);
     /* copy the worker information in the shared area so the health-checker can extract the
part it need */
-    apr_status_t (*add_entry)(proxy_worker *worker, char *balancer_name, int id);
+    apr_status_t (*add_entry)(proxy_worker *worker, const char *balancer_name, int id);
     /* XXX : Remove the entry */
     apr_status_t (*del_entry)(int id);
     /* read the health of the entry: for httpd */
@@ -39,7 +39,7 @@
     /* set the health of the entry: for the health-checker */
     apr_status_t (*set_health)(int id, int value);
     /* read the entry stored in the shared area */
-    apr_status_t (*get_entry)(proxy_worker **worker, char **balancer_name, apr_pool_t *pool);
+    apr_status_t (*get_entry)(int id, proxy_worker **worker, char **balancer_name, apr_pool_t
*pool);
     /* read the conf part. */
     apr_status_t (*get_entryconf)(int id, proxy_worker_conf **worker, char **balancer_name,
apr_pool_t *pool);
     /* check the back-end server health */
@@ -96,3 +96,10 @@
     apr_time_t          time_checked;
 };
 
+/*
+ * Other routines.
+ */
+const health_worker_method *health_checker_get_storage();
+void health_checker_init_slotmem_storage(const slotmem_storage_method * storage);
+void health_checker_init_slotmem(ap_slotmem_t *score);
+const slotmem_storage_method * health_checker_get_slotmem_storage();

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c Fri Jul 28 16:37:15
2006
@@ -2251,7 +2251,7 @@
 }
 
 /* Store the worker information in the comarea */
-PROXY_DECLARE(void) proxy_checkstorage_add_entry(proxy_worker *worker, char *balancer_name)
+PROXY_DECLARE(void) proxy_checkstorage_add_entry(proxy_worker *worker, const char *balancer_name)
 {
     if (checkstorage) {
         checkstorage->add_entry(worker, balancer_name, worker->id);

Modified: httpd/httpd/branches/httpd-proxy-scoreboard/support/proxymonitor.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/support/proxymonitor.c?rev=426708&r1=426707&r2=426708&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/support/proxymonitor.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/support/proxymonitor.c Fri Jul 28 16:37:15
2006
@@ -36,8 +36,9 @@
 #include "mod_proxy.h"
 #include "ajp.h"
 
-#include "mod_proxy_health_checker.h"
 #include "slotmem.h"
+#include "sharedmem_util.h"
+#include "mod_proxy_health_checker.h"
 
 #if APR_HAVE_UNISTD_H
 #include <unistd.h>
@@ -50,7 +51,7 @@
 
 static apr_time_t now;  /* start time of this processing run */
 
-extern int AP_DECLARE_DATA ap_default_loglevel = APLOG_ERR;
+extern int AP_DECLARE_DATA ap_default_loglevel;
 
 static apr_file_t *errfile;   /* stderr file handle */
 static apr_file_t *outfile;   /* stdout file handle */
@@ -67,7 +68,7 @@
 {
     apr_size_t size;
     apr_status_t rv;
-    slotmem_storage_method *checkstorage;
+    const slotmem_storage_method *checkstorage;
     ap_slotmem_t *myscore;
     
     sharedmem_initglobalpool(pool);



Mime
View raw message