mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Allow for modules to keep track of worker slot
numbers themselves if they want, by allowing for worker create/alloc functions to take a slot number id. Done via _wid() variants of 3 proxy funcs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@964089 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -234,6 +234,7 @@
|
|||||||
* 20100630.0 (2.3.7-dev) make module_levels vector of char instead of int
|
* 20100630.0 (2.3.7-dev) make module_levels vector of char instead of int
|
||||||
* 20100701.0 (2.3.7-dev) re-order struct members to improve alignment
|
* 20100701.0 (2.3.7-dev) re-order struct members to improve alignment
|
||||||
* 20100701.1 (2.3.7-dev) add note_auth_failure hook
|
* 20100701.1 (2.3.7-dev) add note_auth_failure hook
|
||||||
|
* 20100701.2 (2.3.7-dev) add ap_proxy_*_wid() functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
|
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
|
||||||
@@ -241,7 +242,7 @@
|
|||||||
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
||||||
#define MODULE_MAGIC_NUMBER_MAJOR 20100701
|
#define MODULE_MAGIC_NUMBER_MAJOR 20100701
|
||||||
#endif
|
#endif
|
||||||
#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
|
#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
||||||
|
@@ -526,6 +526,21 @@ typedef __declspec(dllimport) const char *
|
|||||||
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
const char *url);
|
const char *url);
|
||||||
|
/**
|
||||||
|
* Add the worker to proxy configuration
|
||||||
|
* @param worker the new worker
|
||||||
|
* @param p memory pool to allocate worker from
|
||||||
|
* @param conf current proxy server configuration
|
||||||
|
* @param url url containing worker name
|
||||||
|
* @param id slotnumber id or -1 for auto allocation
|
||||||
|
* @return error message or NULL if successfull
|
||||||
|
*/
|
||||||
|
PROXY_DECLARE(const char *) ap_proxy_add_worker_wid(proxy_worker **worker,
|
||||||
|
apr_pool_t *p,
|
||||||
|
proxy_server_conf *conf,
|
||||||
|
const char *url,
|
||||||
|
int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the worker to proxy configuration
|
* Add the worker to proxy configuration
|
||||||
* @param worker the new worker
|
* @param worker the new worker
|
||||||
@@ -539,6 +554,14 @@ PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
|
|||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
const char *url);
|
const char *url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new worker
|
||||||
|
* @param p memory pool to allocate worker from
|
||||||
|
* @param id slotnumber id or -1 for auto allocation
|
||||||
|
* @return new worker
|
||||||
|
*/
|
||||||
|
PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker_wid(apr_pool_t *p, int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new worker
|
* Create new worker
|
||||||
* @param p memory pool to allocate worker from
|
* @param p memory pool to allocate worker from
|
||||||
@@ -591,6 +614,18 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
|
|||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
const char *url);
|
const char *url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the worker to the balancer
|
||||||
|
* @param pool memory pool for adding worker
|
||||||
|
* @param balancer balancer to add to
|
||||||
|
* @param worker worker to add
|
||||||
|
* @param id slotnumber id or -1 for auto allocation
|
||||||
|
* @note Single worker can be added to multiple balancers.
|
||||||
|
*/
|
||||||
|
PROXY_DECLARE(void) ap_proxy_add_worker_to_balancer_wid(apr_pool_t *pool,
|
||||||
|
proxy_balancer *balancer,
|
||||||
|
proxy_worker *worker,
|
||||||
|
int id);
|
||||||
/**
|
/**
|
||||||
* Add the worker to the balancer
|
* Add the worker to the balancer
|
||||||
* @param pool memory pool for adding worker
|
* @param pool memory pool for adding worker
|
||||||
|
@@ -1442,10 +1442,11 @@ static void init_conn_pool(apr_pool_t *p, proxy_worker *worker)
|
|||||||
worker->cp = cp;
|
worker->cp = cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
|
PROXY_DECLARE(const char *) ap_proxy_add_worker_wid(proxy_worker **worker,
|
||||||
apr_pool_t *p,
|
apr_pool_t *p,
|
||||||
proxy_server_conf *conf,
|
proxy_server_conf *conf,
|
||||||
const char *url)
|
const char *url,
|
||||||
|
int id)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
apr_uri_t uri;
|
apr_uri_t uri;
|
||||||
@@ -1467,27 +1468,35 @@ PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
|
|||||||
(*worker)->scheme = uri.scheme;
|
(*worker)->scheme = uri.scheme;
|
||||||
(*worker)->hostname = uri.hostname;
|
(*worker)->hostname = uri.hostname;
|
||||||
(*worker)->port = uri.port;
|
(*worker)->port = uri.port;
|
||||||
(*worker)->id = proxy_lb_workers;
|
if (id < 0) {
|
||||||
|
(*worker)->id = proxy_lb_workers;
|
||||||
|
proxy_lb_workers++;
|
||||||
|
} else {
|
||||||
|
(*worker)->id = id;
|
||||||
|
}
|
||||||
(*worker)->flush_packets = flush_off;
|
(*worker)->flush_packets = flush_off;
|
||||||
(*worker)->flush_wait = PROXY_FLUSH_WAIT;
|
(*worker)->flush_wait = PROXY_FLUSH_WAIT;
|
||||||
(*worker)->smax = -1;
|
(*worker)->smax = -1;
|
||||||
/* Increase the total worker count */
|
/* Increase the total worker count */
|
||||||
proxy_lb_workers++;
|
|
||||||
(*worker)->cp = NULL;
|
(*worker)->cp = NULL;
|
||||||
(*worker)->mutex = NULL;
|
(*worker)->mutex = NULL;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker(apr_pool_t *p)
|
PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker_wid(apr_pool_t *p, int id)
|
||||||
{
|
{
|
||||||
|
|
||||||
proxy_worker *worker;
|
proxy_worker *worker;
|
||||||
worker = (proxy_worker *)apr_pcalloc(p, sizeof(proxy_worker));
|
worker = (proxy_worker *)apr_pcalloc(p, sizeof(proxy_worker));
|
||||||
worker->id = proxy_lb_workers;
|
if (id < 0) {
|
||||||
|
worker->id = proxy_lb_workers;
|
||||||
|
/* Increase the total worker count */
|
||||||
|
proxy_lb_workers++;
|
||||||
|
} else {
|
||||||
|
worker->id = id;
|
||||||
|
}
|
||||||
worker->smax = -1;
|
worker->smax = -1;
|
||||||
/* Increase the total worker count */
|
|
||||||
proxy_lb_workers++;
|
|
||||||
worker->cp = NULL;
|
worker->cp = NULL;
|
||||||
worker->mutex = NULL;
|
worker->mutex = NULL;
|
||||||
|
|
||||||
@@ -1495,19 +1504,43 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker(apr_pool_t *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PROXY_DECLARE(void)
|
PROXY_DECLARE(void)
|
||||||
ap_proxy_add_worker_to_balancer(apr_pool_t *pool, proxy_balancer *balancer,
|
ap_proxy_add_worker_to_balancer_wid(apr_pool_t *pool, proxy_balancer *balancer,
|
||||||
proxy_worker *worker)
|
proxy_worker *worker, int id)
|
||||||
{
|
{
|
||||||
proxy_worker **runtime;
|
proxy_worker **runtime;
|
||||||
|
|
||||||
runtime = apr_array_push(balancer->workers);
|
runtime = apr_array_push(balancer->workers);
|
||||||
*runtime = worker;
|
*runtime = worker;
|
||||||
(*runtime)->id = proxy_lb_workers;
|
if (id < 0) {
|
||||||
/* Increase the total runtime count */
|
(*runtime)->id = proxy_lb_workers;
|
||||||
proxy_lb_workers++;
|
/* Increase the total runtime count */
|
||||||
|
proxy_lb_workers++;
|
||||||
|
} else {
|
||||||
|
(*runtime)->id = id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROXY_DECLARE(const char *) ap_proxy_add_worker(proxy_worker **worker,
|
||||||
|
apr_pool_t *p,
|
||||||
|
proxy_server_conf *conf,
|
||||||
|
const char *url)
|
||||||
|
{
|
||||||
|
return ap_proxy_add_worker_wid(worker, p, conf, url, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PROXY_DECLARE(proxy_worker *) ap_proxy_create_worker(apr_pool_t *p)
|
||||||
|
{
|
||||||
|
return ap_proxy_create_worker_wid(p, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
PROXY_DECLARE(void)
|
||||||
|
ap_proxy_add_worker_to_balancer(apr_pool_t *pool, proxy_balancer *balancer,
|
||||||
|
proxy_worker *worker)
|
||||||
|
{
|
||||||
|
ap_proxy_add_worker_to_balancer_wid(pool, balancer, worker, -1);
|
||||||
|
}
|
||||||
|
|
||||||
PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
||||||
proxy_balancer **balancer,
|
proxy_balancer **balancer,
|
||||||
request_rec *r,
|
request_rec *r,
|
||||||
|
Reference in New Issue
Block a user