master_status.available_count as specified in configuration file */
#define MASTER_CLIENT_LIMIT_ENV "CLIENT_LIMIT"
+/* getenv(MASTER_SERVICE_COUNT_ENV) specifies how many client connections the
+ process can finish handling before it should kill itself. */
+#define MASTER_SERVICE_COUNT_ENV "SERVICE_COUNT"
+
/* getenv(MASTER_CONFIG_FILE_ENV) provides path to configuration file/socket */
#define MASTER_CONFIG_FILE_ENV "CONFIG_FILE"
i_fatal(MASTER_CLIENT_LIMIT_ENV" not set");
master_service_set_client_limit(service, count);
+ /* set the default service count */
+ value = getenv(MASTER_SERVICE_COUNT_ENV);
+ count = value == NULL ? 0 :
+ (unsigned int)strtoul(value, NULL, 10);
+ if (count > 0)
+ master_service_set_service_count(service, count);
+
/* start listening errors for status fd, it means master died */
service->io_status_error = io_add(MASTER_STATUS_FD, IO_ERROR,
master_status_error, service);
DEF(SET_UINT, process_limit),
DEF(SET_UINT, client_limit),
+ DEF(SET_UINT, service_count),
DEF(SET_UINT, vsz_limit),
DEFLIST(unix_listeners, "unix_listener",
MEMBER(process_limit) (unsigned int)-1,
MEMBER(client_limit) 0,
+ MEMBER(service_count) 0,
MEMBER(vsz_limit) 256,
MEMBER(unix_listeners) ARRAY_INIT,
unsigned int process_limit;
unsigned int client_limit;
+ unsigned int service_count;
unsigned int vsz_limit;
ARRAY_TYPE(file_listener_settings) unix_listeners;
/* fallback to default limit */
limit = service->set->master_set->default_client_limit;
}
-
env_put(t_strdup_printf(MASTER_CLIENT_LIMIT_ENV"=%u", limit));
+ if (service->set->service_count != 0) {
+ env_put(t_strdup_printf(MASTER_SERVICE_COUNT_ENV"=%u",
+ service->set->service_count));
+ }
env_put(t_strdup_printf(MASTER_UID_ENV"=%u", uid));
if (!service->set->master_set->version_ignore)