You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Vinicius Petrucci <vp...@ic.uff.br> on 2008/09/23 06:35:49 UTC

changing balancers' elements

hi,

i'm writing a module which needs to modifiy the elements (workers) of
load balancers. That is, to move workers between different balancers.

for example, suppose we have two balancers b1 and b2.  also, we have a
worker "w"  to be moved from "b1" to "b2"

Basically, I do a push in b2->workers array:

new_worker = apr_array_push(b2->workers);
memcpy(new_worker, w, sizeof(proxy_worker));

And then I decrement by one the elements from "b1" --- we guarantee
the b1->workers array positions are fixed (shifted):

proxy_worker *tmp_w = w++;
for (j = i; j < b1->workers->nelts-1; j++, tmp_w = w, w++) {
    memcpy(tmp_w, w, sizeof(proxy_worker));
}
b1->workers->nelts--;

the problem is that in my module these changes are made. but when I
use the balancer-manager interface to list the balancer and respective
workers, nothing has changed. This information isn't shared between
the modules?

i'm using the following piece of code to get the configuration so that
I can get balancer and worker data structures references:

conf = (proxy_server_conf *)
ap_get_module_config(frontend_info->s->module_config, &proxy_module);
balancer = (proxy_balancer *) conf->balancers->elts;

thanks,

vinicius