From df6f320aa47026bbf589a3276a0708ea3f93504b Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 16 Aug 2011 11:07:27 -0400 Subject: s3-prefrok: Handle only valid children Children that are about to exit shouldn't be counted as a source of connections, and also makes no sense to chenge their allowances if they are about to exit. Also children with negative num_clients are faulty, exclude them as well. Signed-off-by: Andreas Schneider Signed-off-by: Simo Sorce --- source3/lib/server_prefork.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c index 7d675485a0..71441c3303 100644 --- a/source3/lib/server_prefork.c +++ b/source3/lib/server_prefork.c @@ -292,7 +292,7 @@ int prefork_count_active_children(struct prefork_pool *pfp, int *total) t++; - if (pfp->pool[i].num_clients == 0) { + if (pfp->pool[i].num_clients <= 0) { continue; } @@ -343,7 +343,12 @@ int prefork_count_allowed_connections(struct prefork_pool *pfp) c = 0; for (i = 0; i < pfp->pool_size; i++) { - if (pfp->pool[i].status == PF_WORKER_NONE) { + if (pfp->pool[i].status == PF_WORKER_NONE || + pfp->pool[i].status == PF_WORKER_EXITING) { + continue; + } + + if (pfp->pool[i].num_clients < 0) { continue; } @@ -358,7 +363,12 @@ void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max) int i; for (i = 0; i < pfp->pool_size; i++) { - if (pfp->pool[i].status == PF_WORKER_NONE) { + if (pfp->pool[i].status == PF_WORKER_NONE || + pfp->pool[i].status == PF_WORKER_EXITING) { + continue; + } + + if (pfp->pool[i].num_clients < 0) { continue; } @@ -373,7 +383,12 @@ void prefork_decrease_allowed_clients(struct prefork_pool *pfp) int i; for (i = 0; i < pfp->pool_size; i++) { - if (pfp->pool[i].status == PF_WORKER_NONE) { + if (pfp->pool[i].status == PF_WORKER_NONE || + pfp->pool[i].status == PF_WORKER_EXITING) { + continue; + } + + if (pfp->pool[i].num_clients < 0) { continue; } -- cgit