Author: jfrederic.clere(a)jboss.com
Date: 2008-06-17 09:13:35 -0400 (Tue, 17 Jun 2008)
New Revision: 1705
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Allow to compile with 2.2.3.
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-17 09:51:01 UTC
(rev 1704)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-06-17 13:13:35 UTC
(rev 1705)
@@ -47,6 +47,12 @@
struct proxy_cluster_helper {
int count_active; /* currently active request using the worker */
+#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
+#else
+ apr_interval_time_t ping_timeout;
+ char ping_timeout_set;
+#endif
+
};
typedef struct proxy_cluster_helper proxy_cluster_helper;
@@ -116,12 +122,18 @@
}
(*worker)->flush_packets = node->mess.flushpackets;
(*worker)->flush_wait = node->mess.flushwait;
+#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
(*worker)->ping_timeout = node->mess.ping;
(*worker)->ping_timeout_set = 1;
+ (*worker)->acquire_set = 1;
+#else
+ helperping- = (*worker)->opaque;
+ helperping->ping_timeout = node->mess.ping;
+ helperping->ping_timeout_set = 1;
+#endif
(*worker)->keepalive = 1;
(*worker)->keepalive_set = 1;
(*worker)->is_address_reusable = 1;
- (*worker)->acquire_set = 1;
(*worker)->acquire = apr_time_make(0, 2 * 1000); /* 2 ms */
/*
@@ -176,6 +188,8 @@
proxy_worker *worker = NULL;
if (!balancer) {
/* Create one */
+ int sizebal, i;
+ int *bal;
ap_log_error(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0, server,
"add_workers_node: Create balancer %s", name);
balancer = apr_array_push(conf->balancers);
@@ -192,6 +206,24 @@
"add_workers_node: Can't create lock for
balancer");
}
#endif
+
+ /* XXX: Missing logic to copy the shared memory information to the balancer */
+ /* the balancer must be searched using the name (node->balancer) */
+ /* read the ident of the nodes */
+ bal = apr_pcalloc(pool, sizeof(int) *
balancer_storage->get_max_size_balancer());
+ sizebal = balancer_storage->get_ids_used_balancer(bal);
+ for (i=0; i<sizebal; i++) {
+ balancerinfo_t *balan;
+ balancer_storage->read_balancer(bal[i], &balan);
+ if (strcmp(balan->balancer, balancer->name) == 0) {
+ /* XXX: not yet finished
+ balancer->sticky
+ balancer->sticky_force */
+ balancer->max_attempts = balan->Maxattempts;
+ balancer->max_attempts_set = 1;
+ break;
+ }
+ }
}
if (balancer) {
create_worker(conf, balancer, server, &worker, node);
@@ -824,6 +856,10 @@
apr_status_t rv;
proxy_conn_rec *conn;
apr_interval_time_t timeout;
+#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
+#else
+ proxy_cluster_helper *helperping;
+#endif
/* get the proxy_conn_rec: from ap_proxy_acquire_connection */
#if APR_HAS_THREADS
/* prefork() is not "safe" as we have now 2 threads... */
@@ -902,7 +938,12 @@
return rv;
}
+#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
timeout = worker->ping_timeout;
+#else
+ helperping = worker->opaque;
+ timeout = helperping->ping_timeout;
+#endif
if (timeout <= 0)
timeout = apr_time_from_sec(10); /* 10 seconds */
@@ -969,7 +1010,9 @@
* mark worker in error for the moment
*/
worker->s->status |= PROXY_WORKER_IN_ERROR;
+#if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
worker->s->status |= PROXY_WORKER_HOT_STANDBY;
+#endif
}
else {
worker->s->status &= ~PROXY_WORKER_IN_ERROR;
Show replies by date