Commit fcee63ac authored by Jean-Frederic Clere's avatar Jean-Frederic Clere
Browse files

Arrange the warning. Thanks Jim.

parent dc470dc4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 int pre_config(apr_pool_t *p, apr_pool_t *plog,

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);
+4 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#define CORE_PRIVATE

#include "apr.h"
#include "apr_strings.h"
#include "apr_pools.h"
#include "apr_shm.h"

@@ -28,6 +29,7 @@
#include "http_log.h"

#include "slotmem.h"
#include "sharedmem_util.h"

/* The description of the slots to reuse the slotmem */
struct sharedslotdesc {
@@ -230,7 +232,7 @@ static const slotmem_storage_method storage = {
};

/* make the storage usuable from outside */
slotmem_storage_method *sharedmem_getstorage()
const slotmem_storage_method *sharedmem_getstorage()
{
    return(&storage);
}
+20 −0
Original line number Diff line number Diff line
/* 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();
+33 −17
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ static int getentrysize()
    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 set_health(int id, int value)
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 @@ static apr_status_t get_entry(int id, proxy_worker **worker, char **balancer_nam
    /* 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 @@ static apr_status_t get_entry(int id, proxy_worker **worker, char **balancer_nam
    // 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 @@ static apr_status_t get_entryconf(int id, struct proxy_worker_conf **workerconf,

    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 @@ static apr_status_t check_entryhealth(int id, apr_pool_t *pool) {

    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 @@ static const health_worker_method worker_storage = {
};

/* 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);
}
+5 −0
Original line number Diff line number Diff line
@@ -446,6 +446,10 @@ APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, request_status,

/* 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);
@@ -716,6 +720,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
                                           apr_bucket_brigade *brigade);


/* Scoreboard */
#if MODULE_MAGIC_NUMBER_MAJOR > 20020903
#define PROXY_HAS_SCOREBOARD 1
Loading