From: Jean-Frederic Clere Date: Wed, 26 Jul 2006 15:21:19 +0000 (+0000) Subject: Try to have something that has the right size. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4963008b415c65e040ef5389d41d393767b0c8fd;p=thirdparty%2Fapache%2Fhttpd.git Try to have something that has the right size. The remaining problem is that proxy_lb_workers() only gives a good value when the config file has been parsed (can't be used in preconfig(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@425759 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mem/mod_scoreboard.c b/modules/mem/mod_scoreboard.c index 03038b11e13..7b7f0ea8b40 100644 --- a/modules/mem/mod_scoreboard.c +++ b/modules/mem/mod_scoreboard.c @@ -87,7 +87,19 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_ static apr_status_t ap_slotmem_attach(ap_slotmem_t **new, const char *name, apr_size_t *item_size, int *item_num, apr_pool_t *pool) { - return(ap_slotmem_create(new, name, item_size, item_num, pool)); + apr_size_t size; + int num; + apr_status_t rv; + + size = sizeof(lb_score); + /* XXX: proxy_lb_workers only returns something valid after parsing the configuration */ + num = proxy_lb_workers(); + rv = ap_slotmem_create(new, name, size, num, pool); + if (rv == APR_SUCCESS) { + *item_size = size; + *item_num = num; + } + return rv; } static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem) @@ -112,6 +124,7 @@ static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem) static const slotmem_storage_method storage = { &ap_slotmem_do, &ap_slotmem_create, + &ap_slotmem_attach, &ap_slotmem_mem };