Author: jfrederic.clere(a)jboss.com
Date: 2008-05-29 10:34:51 -0400 (Thu, 29 May 2008)
New Revision: 1641
Modified:
trunk/mod_cluster/native/include/node.h
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
And parser of all the parameters defined in the wiki spec's.
Modified: trunk/mod_cluster/native/include/node.h
===================================================================
--- trunk/mod_cluster/native/include/node.h 2008-05-29 10:13:06 UTC (rev 1640)
+++ trunk/mod_cluster/native/include/node.h 2008-05-29 14:34:51 UTC (rev 1641)
@@ -60,9 +60,10 @@
/* node conf part */
int flushpackets;
int flushwait;
- int ping;
+ apr_time_t ping;
int smax;
- int ttl;
+ apr_time_t ttl;
+ apr_time_t timeout;
/* part updated in httpd */
int id; /* id in table and worker id */
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-29 10:13:06 UTC (rev 1640)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-29 14:34:51 UTC (rev 1641)
@@ -57,6 +57,7 @@
#define TYPESYNTAX 1
#define SMESPAR "SYNTAX: Can't parse message"
#define SBALBIG "SYNTAX: Balancer field too big"
+#define SBAFBIG "SYNTAX: A field is too big"
#define SROUBIG "SYNTAX: JVMRoute field too big"
#define SDOMBIG "SYNTAX: Domain field too big"
#define SHOSBIG "SYNTAX: Host field too big"
@@ -414,13 +415,18 @@
/*
* Process a CONFIG message
+ * Balancer: <Balancer name>
+ * <balancer configuration>
+ * StickySession StickySessionCookie StickySessionPath StickySessionRemove
+ * StickySessionForce Timeout Maxattempts
* JvmRoute?: <JvmRoute>
* Domain: <Domain>
* <Host: <Node IP>
* Port: <Connector Port>
* Type: <Type of the connector>
- * Reserved: <Use connection pool initiated by Tomcat *.
- * (<node conf>
+ * Reserved: <Use connection pool initiated by Tomcat *.>
+ * <node conf>
+ * flushpackets flushwait ping smax ttl
* Virtual hosts in JBossAS
* Alias: <vhost list>
* Context corresponding to the applications.
@@ -469,6 +475,7 @@
ap_mpm_query(AP_MPMQ_MAX_THREADS, &mpm_threads);
nodeinfo.mess.smax = mpm_threads + 1;
nodeinfo.mess.ttl = apr_time_from_sec(60);
+ nodeinfo.mess.timeout = 0;
/* Fill default balancer values */
memset(&balancerinfo, '\0', sizeof(balancerinfo));
@@ -477,6 +484,7 @@
strcpy(balancerinfo.StickySessionCookie, "JSESSIONID");
strcpy(balancerinfo.StickySessionPath, "jsessionid");
balancerinfo.Maxattempts = 1;
+ balancerinfo.Timeout = 0;
int i = 0;
while (ptr[i]) {
@@ -489,6 +497,39 @@
strcpy(nodeinfo.mess.balancer, ptr[i+1]);
strcpy(balancerinfo.balancer, ptr[i+1]);
}
+ if (strcasecmp(ptr[i], "StickySession") == 0) {
+ if (strcasecmp(ptr[i+1], "no") == 0)
+ balancerinfo.StickySession = 0;
+ }
+ if (strcasecmp(ptr[i], "StickySessionCookie") == 0) {
+ if (strlen(ptr[i+1])>=sizeof(balancerinfo.StickySessionCookie)) {
+ *errtype = TYPESYNTAX;
+ return SBAFBIG;
+ }
+ strcpy(balancerinfo.StickySessionCookie, ptr[i+1]);
+ }
+ if (strcasecmp(ptr[i], "StickySessionPath") == 0) {
+ if (strlen(ptr[i+1])>=sizeof(balancerinfo.StickySessionPath)) {
+ *errtype = TYPESYNTAX;
+ return SBAFBIG;
+ }
+ strcpy(balancerinfo.StickySessionPath, ptr[i+1]);
+ }
+ if (strcasecmp(ptr[i], "StickySessionRemove") == 0) {
+ if (strcasecmp(ptr[i+1], "yes") == 0)
+ balancerinfo.StickySession = 1;
+ }
+ if (strcasecmp(ptr[i], "StickySessionForce") == 0) {
+ if (strcasecmp(ptr[i+1], "no") == 0)
+ balancerinfo.StickySessionForce = 0;
+ }
+ if (strcasecmp(ptr[i], "WaitWorker") == 0) {
+ balancerinfo.Timeout = apr_time_from_sec(atoi(ptr[i+1]));
+ }
+ if (strcasecmp(ptr[i], "Maxattempts") == 0) {
+ balancerinfo.Maxattempts = atoi(ptr[i+1]);
+ }
+
/* XXX: Node part */
if (strcasecmp(ptr[i], "JVMRoute") == 0) {
if (strlen(ptr[i+1])>=sizeof(nodeinfo.mess.JVMRoute)) {
@@ -530,6 +571,31 @@
nodeinfo.mess.reversed = 1;
}
}
+ if (strcasecmp(ptr[i], "flushpackets") == 0) {
+ if (strcasecmp(ptr[i+1], "on") == 0) {
+ nodeinfo.mess.flushpackets = flush_on;
+ }
+ else if (strcasecmp(ptr[i+1], "auto") == 0) {
+ nodeinfo.mess.flushpackets = flush_auto;
+ }
+ }
+ if (strcasecmp(ptr[i], "flushwait") == 0) {
+ nodeinfo.mess.flushwait = atoi(ptr[i+1]) * 1000;
+ }
+ if (strcasecmp(ptr[i], "ping") == 0) {
+ nodeinfo.mess.ping = apr_time_from_sec(atoi(ptr[i+1]));
+ }
+ if (strcasecmp(ptr[i], "smax") == 0) {
+ nodeinfo.mess.smax = atoi(ptr[i+1]);
+ }
+ if (strcasecmp(ptr[i], "ttl") == 0) {
+ nodeinfo.mess.ttl = apr_time_from_sec(atoi(ptr[i+1]));
+ }
+ if (strcasecmp(ptr[i], "Timeout") == 0) {
+ nodeinfo.mess.timeout = apr_time_from_sec(atoi(ptr[i+1]));
+ }
+
+ /* Hosts and contexts (optional paramters) */
if (strcasecmp(ptr[i], "Alias") == 0) {
if (phost->host && !phost->context) {
*errtype = TYPESYNTAX;
@@ -597,9 +663,11 @@
for (i=0; i<size; i++) {
balancerinfo_t *ou;
get_balancer(balancerstatsmem, &ou, id[i]);
- ap_rprintf(r, "balancer: [%d] Name: %s Sticky: %d [%s]/[%s]\n",
+ ap_rprintf(r, "balancer: [%d] Name: %s Sticky: %d [%s]/[%s] remove: %d
force: %d Timeout: %d Maxtry: %d\n",
id[i], ou->balancer, ou->StickySession,
- ou->StickySessionCookie, ou->StickySessionPath);
+ ou->StickySessionCookie, ou->StickySessionPath,
+ ou->StickySessionRemove, ou->StickySessionForce,
ou->Timeout,
+ ou->Maxattempts);
}
size = get_max_size_node(nodestatsmem);
@@ -608,9 +676,11 @@
for (i=0; i<size; i++) {
nodeinfo_t *ou;
get_node(nodestatsmem, &ou, id[i]);
- ap_rprintf(r, "node: [%d:%d] Balancer: %s JVMRoute: %s Domain: [%s] Host: %s
Port: %s Type: %s\n",
+ ap_rprintf(r, "node: [%d:%d] Balancer: %s JVMRoute: %s Domain: [%s] Host: %s
Port: %s Type: %s flushpackets: %d flushwait: %d ping: %d smax: %d ttl: %d timeout:
%d\n",
id[i], ou->mess.id, ou->mess.balancer, ou->mess.JVMRoute,
ou->mess.Domain,
- ou->mess.Host, ou->mess.Port, ou->mess.Type);
+ ou->mess.Host, ou->mess.Port, ou->mess.Type,
+ ou->mess.flushpackets, ou->mess.flushwait/1000,
apr_time_sec(ou->mess.ping), ou->mess.smax,
+ apr_time_sec(ou->mess.ttl), apr_time_sec(ou->mess.timeout));
}
size = get_max_size_host(hoststatsmem);
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-05-29 10:13:06 UTC
(rev 1640)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-05-29 14:34:51 UTC
(rev 1641)
@@ -111,6 +111,10 @@
(*worker)->redirect = apr_pstrdup(conf->pool, "");
(*worker)->smax = node->mess.smax;
(*worker)->ttl = node->mess.ttl;
+ if (node->mess.timeout) {
+ (*worker)->timeout_set = 1;
+ (*worker)->timeout = node->mess.timeout;
+ }
(*worker)->flush_packets = node->mess.flushpackets;
(*worker)->flush_wait = node->mess.flushwait;
(*worker)->ping_timeout = node->mess.ping;