Skip to content

Commit 8cdda23

Browse files
committed
mpm_event: Use async_factor instead of worker_factor (no functional change).
1 parent ead42ba commit 8cdda23

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

server/mpm/event/event.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@
168168
* Actual definitions of config globals
169169
*/
170170

171-
#ifndef DEFAULT_WORKER_FACTOR
172-
#define DEFAULT_WORKER_FACTOR 2
171+
#ifndef DEFAULT_ASYNC_FACTOR
172+
#define DEFAULT_ASYNC_FACTOR 2
173173
#endif
174174
#define WORKER_FACTOR_SCALE 16 /* scale factor to allow fractional values */
175-
static unsigned int worker_factor = DEFAULT_WORKER_FACTOR * WORKER_FACTOR_SCALE;
175+
static apr_uint32_t async_factor = DEFAULT_ASYNC_FACTOR;
176176
/* AsyncRequestWorkerFactor * 16 */
177177

178178
static int threads_per_child = 0; /* ThreadsPerChild */
@@ -675,7 +675,7 @@ static APR_INLINE int connections_above_limit(int *busy)
675675
/* Off by 'listeners_disabled()' to avoid flip flop */
676676
|| c_count - l_count < (apr_uint32_t)threads_per_child +
677677
(i_count - listeners_disabled()) *
678-
(worker_factor / WORKER_FACTOR_SCALE)) {
678+
async_factor) {
679679
return 0;
680680
}
681681
}
@@ -2880,7 +2880,6 @@ static void setup_threads_runtime(void)
28802880
APR_POLLSET_PORT,
28812881
APR_POLLSET_EPOLL };
28822882
/* XXX: K-A or lingering close connection included in the async factor */
2883-
const apr_uint32_t async_factor = worker_factor / WORKER_FACTOR_SCALE;
28842883
const apr_uint32_t pollset_size = (apr_uint32_t)num_listensocks +
28852884
(apr_uint32_t)threads_per_child *
28862885
(async_factor > 2 ? async_factor : 2);
@@ -4639,6 +4638,7 @@ static const char *set_worker_factor(cmd_parms * cmd, void *dummy,
46394638
{
46404639
double val;
46414640
char *endptr;
4641+
apr_uint32_t factor;
46424642
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
46434643
if (err != NULL) {
46444644
return err;
@@ -4651,9 +4651,10 @@ static const char *set_worker_factor(cmd_parms * cmd, void *dummy,
46514651
if (val <= 0)
46524652
return "AsyncRequestWorkerFactor argument must be a positive number";
46534653

4654-
worker_factor = val * WORKER_FACTOR_SCALE;
4655-
if (worker_factor < WORKER_FACTOR_SCALE) {
4656-
worker_factor = WORKER_FACTOR_SCALE;
4654+
factor = val * WORKER_FACTOR_SCALE;
4655+
async_factor = factor / WORKER_FACTOR_SCALE;
4656+
if (async_factor < 1) {
4657+
async_factor = 1;
46574658
}
46584659
return NULL;
46594660
}

0 commit comments

Comments
 (0)