Author: jfrederic.clere(a)jboss.com
Date: 2008-05-27 02:40:15 -0400 (Tue, 27 May 2008)
New Revision: 1621
Modified:
trunk/mod_cluster/native/include/node.h
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Add logic to process *-APP * commands.
Add remove to the node description.
Modified: trunk/mod_cluster/native/include/node.h
===================================================================
--- trunk/mod_cluster/native/include/node.h 2008-05-26 18:20:04 UTC (rev 1620)
+++ trunk/mod_cluster/native/include/node.h 2008-05-27 06:40:15 UTC (rev 1621)
@@ -55,6 +55,7 @@
char Port[PORTNODESZ];
char Type[SCHEMENDSZ];
int reversed; /* 1 : reversed... 0 : normal */
+ int remove; /* 1 : removed 0 : normal */
/* node conf part */
int flushpackets;
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-26 18:20:04 UTC (rev 1620)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-27 06:40:15 UTC (rev 1621)
@@ -565,7 +565,56 @@
return NULL;
}
-/* Process an enable/disable/stop application message */
+/* Process a *-APP command that applies to the node */
+static char * process_node_cmd(request_rec *r, int status, int *errtype, nodeinfo_t
*node)
+{
+ /* for read the hosts */
+ int i,j;
+ int size = get_max_size_host(hoststatsmem);
+ int *id = apr_palloc(r->pool, sizeof(int) * size);
+
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "process_node_cmd %d processing node: %d", status,
node->mess.id);
+ size = get_ids_used_host(hoststatsmem, id);
+ for (i=0; i<size; i++) {
+ hostinfo_t *ou;
+ get_host(hoststatsmem, &ou, id[i]);
+ if (ou->node != node->mess.id)
+ continue;
+ /* If the host corresponds to a node process all contextes */
+ int sizecontext = get_max_size_context(contextstatsmem);
+ int *idcontext = apr_palloc(r->pool, sizeof(int) * sizecontext);
+ sizecontext = get_ids_used_context(contextstatsmem, idcontext);
+ for (j=0; j<sizecontext; j++) {
+ contextinfo_t *context;
+ get_context(contextstatsmem, &context, idcontext[j]);
+ if (context->vhost == ou->vhost &&
+ context->node == ou->node) {
+ /* Process the context */
+ if (status != REMOVE) {
+ context->status = status;
+ insert_update_context(contextstatsmem, context);
+ } else
+ remove_context(contextstatsmem, context);
+
+ }
+ }
+ if (status == REMOVE) {
+ remove_host(hoststatsmem, ou);
+ }
+ }
+
+ /* The REMOVE-APP * removes the node (well mark it removed) */
+ if (status == REMOVE) {
+ int id;
+ node->mess.remove = 1;
+ insert_update_node(nodestatsmem, node, &id);
+ }
+ return NULL;
+
+}
+
+/* Process an enable/disable/stop/remove application message */
static char * process_appl_cmd(request_rec *r, char *buff, int status, int *errtype)
{
char *JVMRoute;
@@ -620,6 +669,11 @@
return MNODERD;
}
+ /* Process the * APP commands */
+ if (strcmp(r->uri, "*") == 0) {
+ return (process_node_cmd(r, status, errtype, node));
+ }
+
/* Read the ID of the virtual corresponding to the first Alias */
hostinfo_t hostinfo;
hostinfo_t *host;
Show replies by date