summaryrefslogtreecommitdiff
path: root/source3/lib/server_prefork.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-12 12:24:13 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:04 -0400
commit2a0aac0adcdccc165f5d511d7a1c1d6d0c5d7c9b (patch)
tree0288a7f47035af9cb14b6450751ff02b4894b0e8 /source3/lib/server_prefork.c
parenteb8a0c76725500d183c50eb795c683f23d4aede7 (diff)
downloadsamba-2a0aac0adcdccc165f5d511d7a1c1d6d0c5d7c9b.tar.gz
samba-2a0aac0adcdccc165f5d511d7a1c1d6d0c5d7c9b.tar.bz2
samba-2a0aac0adcdccc165f5d511d7a1c1d6d0c5d7c9b.zip
s3-prefork: Allow better management of allowed_clients
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/lib/server_prefork.c')
-rw-r--r--source3/lib/server_prefork.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c
index a584df7a71..2df6adea9f 100644
--- a/source3/lib/server_prefork.c
+++ b/source3/lib/server_prefork.c
@@ -345,6 +345,23 @@ static void prefork_cleanup_loop(struct prefork_pool *pfp)
}
+int prefork_count_allowed_connections(struct prefork_pool *pfp)
+{
+ int c;
+ int i;
+
+ c = 0;
+ for (i = 0; i < pfp->pool_size; i++) {
+ if (pfp->pool[i].status == PF_WORKER_NONE) {
+ continue;
+ }
+
+ c += pfp->pool[i].allowed_clients - pfp->pool[i].num_clients;
+ }
+
+ return c;
+}
+
void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max)
{
int i;
@@ -360,6 +377,21 @@ void prefork_increase_allowed_clients(struct prefork_pool *pfp, int max)
}
}
+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) {
+ continue;
+ }
+
+ if (pfp->pool[i].allowed_clients > 1) {
+ pfp->pool[i].allowed_clients--;
+ }
+ }
+}
+
void prefork_reset_allowed_clients(struct prefork_pool *pfp)
{
int i;