From 69b654ed180ca4c59f9a230761895b6d46ea7cff Mon Sep 17 00:00:00 2001 From: Jean-Frederic Clere Date: Wed, 6 Sep 2023 10:47:42 +0200 Subject: [PATCH] Arrange code according to the frst set of comments on the PR. --- .../proxy/balancers/mod_lbmethod_bybusyness.c | 1 + modules/proxy/mod_proxy.h | 34 +------------------ modules/proxy/mod_proxy_balancer.c | 1 + modules/proxy/proxy_util.h | 33 ++++++++++++++++++ 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/modules/proxy/balancers/mod_lbmethod_bybusyness.c b/modules/proxy/balancers/mod_lbmethod_bybusyness.c index 3d5d34e7145..e714715eb36 100644 --- a/modules/proxy/balancers/mod_lbmethod_bybusyness.c +++ b/modules/proxy/balancers/mod_lbmethod_bybusyness.c @@ -15,6 +15,7 @@ */ #include "mod_proxy.h" +#include "proxy_util.h" #include "scoreboard.h" #include "ap_mpm.h" #include "apr_version.h" diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 302762830f5..04fee22742a 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -467,7 +467,7 @@ typedef struct { apr_size_t recv_buffer_size; apr_size_t io_buffer_size; apr_size_t elected; /* Number of times the worker was elected */ - volatile apr_size_t busy; /* busyness factor */ + apr_size_t busy; /* busyness factor */ apr_size_t response_field_size; /* Size of proxy response buffer in bytes. */ apr_port_t port; apr_off_t transferred;/* Number of bytes transferred to remote */ @@ -1577,38 +1577,6 @@ PROXY_DECLARE(apr_status_t) ap_proxy_transfer_between_connections( int *sent, apr_off_t bsize, int flags); -/* - * Get the busy counter from the shared worker memory - * - * @param worker_ Pointer to the worker structure. - * @return apr_size_t value atomically read for the worker. - */ -PROXY_DECLARE(apr_size_t) getbusy_count(void *worker_); - -/* - * Set the busy counter from the shared worker memory - * - * @param worker_ Pointer to the worker structure. - * @param busy value to set the busy counter. - * @return void - */ -PROXY_DECLARE(void) setbusy_count(void *worker_, apr_size_t busy); - -/* - * decrement the busy counter from the shared worker memory - * - * @param worker_ Pointer to the worker structure. - * @return apr_status_t returns APR_SUCCESS. - */ -PROXY_DECLARE(apr_status_t) decrement_busy_count(void *worker_); - -/* - * increment the busy counter from the shared worker memory - * - * @param worker_ Pointer to the worker structure. - * @return void - */ -PROXY_DECLARE(void) increment_busy_count(void *worker_); extern module PROXY_DECLARE_DATA proxy_module; diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 46fe2d0191a..97993afc52d 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -17,6 +17,7 @@ /* Load balancer module for Apache proxy */ #include "mod_proxy.h" +#include "proxy_util.h" #include "scoreboard.h" #include "ap_mpm.h" #include "apr_version.h" diff --git a/modules/proxy/proxy_util.h b/modules/proxy/proxy_util.h index bc131da0f0f..e999663ab7d 100644 --- a/modules/proxy/proxy_util.h +++ b/modules/proxy/proxy_util.h @@ -40,6 +40,39 @@ extern PROXY_DECLARE_DATA const apr_strmatch_pattern *ap_proxy_strmatch_domain; */ void proxy_util_register_hooks(apr_pool_t *p); +/* + * Get the busy counter from the shared worker memory + * + * @param worker_ Pointer to the worker structure. + * @return apr_size_t value atomically read for the worker. + */ +PROXY_DECLARE(apr_size_t) getbusy_count(void *worker_); + +/* + * Set the busy counter from the shared worker memory + * + * @param worker_ Pointer to the worker structure. + * @param busy value to set the busy counter. + * @return void + */ +PROXY_DECLARE(void) setbusy_count(void *worker_, apr_size_t busy); + +/* + * decrement the busy counter from the shared worker memory + * + * @param worker_ Pointer to the worker structure. + * @return apr_status_t returns APR_SUCCESS. + */ +PROXY_DECLARE(apr_status_t) decrement_busy_count(void *worker_); + +/* + * increment the busy counter from the shared worker memory + * + * @param worker_ Pointer to the worker structure. + * @return void + */ +PROXY_DECLARE(void) increment_busy_count(void *worker_); + /** @} */ #endif /* PROXY_UTIL_H_ */