#define CLIENT_STATE_IDLE "idling"
#define CLIENT_STATE_STOP "waiting for shutdown"
+static unsigned int auth_worker_max_service_count = 0;
+static unsigned int auth_worker_service_count = 0;
+
struct auth_worker_client {
struct connection conn;
int refcount;
static void auth_worker_client_destroy(struct connection *conn);
static void auth_worker_client_unref(struct auth_worker_client **_client);
+void auth_worker_set_max_service_count(unsigned int count)
+{
+ auth_worker_max_service_count = count;
+}
+
static struct auth_worker_client *auth_worker_get_client(void)
{
if (!auth_worker_has_client())
client->refcount++;
e_debug(cmd->event, "Handling %s request", args[1]);
+ /* Check if we have reached service_count */
+ if (auth_worker_max_service_count > 0) {
+ auth_worker_service_count++;
+ if (auth_worker_service_count >= auth_worker_max_service_count)
+ worker_restart_request = TRUE;
+ }
+
auth_worker_refresh_proctitle(args[1]);
if (strcmp(args[1], "PASSV") == 0)
ret = auth_worker_handle_passv(cmd, id, args + 2, &error);
/* workers have only a single connection from the master
auth process */
master_service_set_client_limit(master_service, 1);
+ auth_worker_set_max_service_count(
+ master_service_get_service_count(master_service));
+ /* make sure this process cycles if auth connection drops */
+ master_service_set_service_count(master_service, 1);
} else {
/* caching is handled only by the main auth process */
passdb_cache_init(global_auth_settings);