JBoss Native SVN: r1662 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-06-05 09:39:42 -0400 (Thu, 05 Jun 2008)
New Revision: 1662
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Fix the warnings when using -Wall -pedantic
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-06-05 13:03:07 UTC (rev 1661)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-06-05 13:39:42 UTC (rev 1662)
@@ -77,6 +77,7 @@
if ((*worker) == NULL) {
/* creates it */
+ proxy_cluster_helper *helper;
const char *err = ap_proxy_add_worker(worker, conf->pool, conf, url);
if (err) {
ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0, server,
@@ -84,7 +85,7 @@
return;
}
(*worker)->opaque = apr_pcalloc(conf->pool, sizeof(proxy_cluster_helper));
- proxy_cluster_helper *helper = (*worker)->opaque;
+ helper = (*worker)->opaque;
helper->count_active = 0;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server,
"Created: worker for %s", url);
@@ -201,6 +202,7 @@
static int remove_workers_node(nodeinfo_t *node, proxy_server_conf *conf, apr_pool_t *pool, server_rec *server)
{
int i;
+ proxy_cluster_helper *helper;
proxy_worker *worker = (proxy_worker *)conf->workers->elts;
for (i = 0; i < conf->workers->nelts; i++) {
if (worker->id == node->mess.id)
@@ -222,7 +224,7 @@
if (worker->cp->res)
i = apr_reslist_acquired_count(worker->cp->res);
#else
- proxy_cluster_helper *helper = worker->opaque;
+ helper = worker->opaque;
i = helper->count_active;
#endif
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server,
@@ -345,7 +347,8 @@
if (conn->inreslist) {
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool,
"proxy: Pooled connection 0x%pp for worker %s has been"
- " already returned to the connection pool.", conn,
+ " already returned to the connection pool.",
+ (void *) conn,
worker->name);
return APR_SUCCESS;
}
@@ -473,6 +476,8 @@
proxy_worker *worker)
{
nodeinfo_t *node;
+ int sizevhost, i;
+ int *vhosts;
node_storage->read_node(worker->id, &node);
@@ -481,10 +486,9 @@
* A node may have several virtual hosts and
* each virtual hosts may have several context
*/
- int sizevhost = host_storage->get_max_size_host();
- int *vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
+ sizevhost = host_storage->get_max_size_host();
+ vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
sizevhost = host_storage->get_ids_used_host(vhosts);
- int i;
for (i=0; i<sizevhost; i++) {
hostinfo_t *vhost;
host_storage->read_host(vhosts[i], &vhost);
@@ -492,10 +496,10 @@
/* XXX Check the virtual host */
/* Check the contexts */
+ int j, len;
int sizecontext = context_storage->get_max_size_context();
int *contexts = apr_palloc(r->pool, sizeof(int)*sizecontext);
sizecontext = context_storage->get_ids_used_context(contexts);
- int j;
for (j=0; j<sizecontext; j++) {
contextinfo_t *context;
context_storage->read_context(contexts[j], &context);
@@ -503,7 +507,7 @@
continue;
/* check for /context[/] in the URL */
- int len = strlen(context->context);
+ len = strlen(context->context);
if (strncmp(r->uri, context->context, len) == 0) {
if (r->uri[len] == '\0' || r->uri[len] == '/') {
/* Check status */
@@ -583,6 +587,10 @@
sizenode = node_storage->get_ids_used_node(nodes);
for (n=0; n<sizenode; n++) {
nodeinfo_t *node;
+ int i;
+ int sizevhost;
+ int *vhosts;
+
node_storage->read_node(nodes[n], &node);
/*
@@ -590,10 +598,9 @@
* A node may have several virtual hosts and
* each virtual hosts may have several context
*/
- int sizevhost = host_storage->get_max_size_host();
- int *vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
+ sizevhost = host_storage->get_max_size_host();
+ vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
sizevhost = host_storage->get_ids_used_host(vhosts);
- int i;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_context_host_balancer testing node %s", node->mess.JVMRoute);
for (i=0; i<sizevhost; i++) {
@@ -603,14 +610,15 @@
/* XXX Check the virtual host */
/* Check the contexts */
+ int j;
int sizecontext = context_storage->get_max_size_context();
int *contexts = apr_palloc(r->pool, sizeof(int)*sizecontext);
sizecontext = context_storage->get_ids_used_context(contexts);
- int j;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"get_context_host_balancer testing host %s", vhost->host);
for (j=0; j<sizecontext; j++) {
contextinfo_t *context;
+ int len;
context_storage->read_context(contexts[j], &context);
if (context->vhost != vhost->vhost)
continue;
@@ -618,7 +626,7 @@
"get_context_host_balancer testing context %s", context->context);
/* check for /context[/] in the URL */
- int len = strlen(context->context);
+ len = strlen(context->context);
if (strncmp(r->uri, context->context, len) == 0) {
if (r->uri[len] == '\0' || r->uri[len] == '/') {
/* Check status */
@@ -740,6 +748,7 @@
{
apr_status_t rv;
proxy_conn_rec *conn;
+ apr_interval_time_t timeout;
/* get the proxy_conn_rec: from ap_proxy_acquire_connection */
#if APR_HAS_THREADS
/* prefork() is not "safe" as we have now 2 threads... */
@@ -818,7 +827,7 @@
return rv;
}
- apr_interval_time_t timeout = worker->ping_timeout;
+ timeout = worker->ping_timeout;
if (timeout <= 0)
timeout = apr_time_from_sec(10); /* 10 seconds */
@@ -996,11 +1005,12 @@
*/
static int proxy_cluster_trans(request_rec *r)
{
+ char *balancer = get_context_host_balancer(r);
+
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_DEBUG, 0, r->server,
"proxy_cluster_trans for %d %s %s uri: %s",
r->proxyreq, r->filename, r->handler, r->uri);
- char *balancer = get_context_host_balancer(r);
if (balancer) {
r->filename = apr_pstrcat(r->pool, "proxy:cluster://", balancer, r->uri, NULL);
r->handler = "proxy-server";
@@ -1395,6 +1405,7 @@
{
apr_status_t rv;
+ proxy_cluster_helper *helper;
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
@@ -1403,7 +1414,6 @@
return HTTP_INTERNAL_SERVER_ERROR;
}
/* mark the work as not use */
- proxy_cluster_helper *helper;
helper = (proxy_cluster_helper *) worker->opaque;
helper->count_active--;