dovecot-2.0: master: Fixes to checks using service's client_limit.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 31 21:14:37 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/2dc1e03cad11
changeset: 9840:2dc1e03cad11
user: Timo Sirainen <tss at iki.fi>
date: Mon Aug 31 14:14:29 2009 -0400
description:
master: Fixes to checks using service's client_limit.
diffstat:
4 files changed, 13 insertions(+), 15 deletions(-)
src/master/service-monitor.c | 2 +-
src/master/service-process.c | 17 +++--------------
src/master/service.c | 6 ++++++
src/master/service.h | 3 +++
diffs (82 lines):
diff -r d76916a6df44 -r 2dc1e03cad11 src/master/service-monitor.c
--- a/src/master/service-monitor.c Mon Aug 31 14:07:35 2009 -0400
+++ b/src/master/service-monitor.c Mon Aug 31 14:14:29 2009 -0400
@@ -91,7 +91,7 @@ static void service_status_input(struct
i_assert(service->process_avail <=
service->process_count);
}
- if (status.available_count == service->set->client_limit)
+ if (status.available_count == service->client_limit)
process->idle_start = ioloop_time;
}
process->available_count = status.available_count;
diff -r d76916a6df44 -r 2dc1e03cad11 src/master/service-process.c
--- a/src/master/service-process.c Mon Aug 31 14:07:35 2009 -0400
+++ b/src/master/service-process.c Mon Aug 31 14:14:29 2009 -0400
@@ -369,7 +369,6 @@ service_process_setup_environment(struct
{
const struct master_service_settings *set = service->list->service_set;
const char *const *p;
- unsigned int limit;
/* remove all environment, and put back what we need */
env_clean();
@@ -396,12 +395,8 @@ service_process_setup_environment(struct
break;
}
- limit = service->set->client_limit;
- if (limit == 0) {
- /* fallback to default limit */
- limit = service->set->master_set->default_client_limit;
- }
- env_put(t_strdup_printf(MASTER_CLIENT_LIMIT_ENV"=%u", limit));
+ env_put(t_strdup_printf(MASTER_CLIENT_LIMIT_ENV"=%u",
+ service->client_limit));
if (service->set->service_count != 0) {
env_put(t_strdup_printf(MASTER_SERVICE_COUNT_ENV"=%u",
service->set->service_count));
@@ -522,13 +517,7 @@ service_process_create(struct service *s
timeout_add(SERVICE_FIRST_STATUS_TIMEOUT_SECS * 1000,
service_process_status_timeout, process);
- process->available_count = service->set->client_limit;
- if (process->available_count == 0) {
- /* fallback to default limit */
- process->available_count =
- service->set->master_set->default_client_limit;
- }
-
+ process->available_count = service->client_limit;
service->process_count++;
service->process_avail++;
diff -r d76916a6df44 -r 2dc1e03cad11 src/master/service.c
--- a/src/master/service.c Mon Aug 31 14:07:35 2009 -0400
+++ b/src/master/service.c Mon Aug 31 14:14:29 2009 -0400
@@ -156,6 +156,12 @@ service_create(pool_t pool, const struct
service = p_new(pool, struct service, 1);
service->list = service_list;
service->set = set;
+
+ service->client_limit = set->client_limit != 0 ? set->client_limit :
+ set->master_set->default_client_limit;
+ if (set->service_count > 0 &&
+ service->client_limit < set->service_count)
+ service->client_limit = set->service_count;
service->type = SERVICE_TYPE_UNKNOWN;
if (*set->type != '\0') {
diff -r d76916a6df44 -r 2dc1e03cad11 src/master/service.h
--- a/src/master/service.h Mon Aug 31 14:07:35 2009 -0400
+++ b/src/master/service.h Mon Aug 31 14:14:29 2009 -0400
@@ -67,6 +67,9 @@ struct service {
unsigned int process_avail;
/* max number of processes allowed */
unsigned int process_limit;
+
+ /* Maximum number of client connections the service can handle. */
+ unsigned int client_limit;
/* log process pipe file descriptors. */
int log_fd[2];
More information about the dovecot-cvs
mailing list