]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
*-login: If we've a pending shutdown and auth connection gets lost, kill clients.
authorTimo Sirainen <tss@iki.fi>
Thu, 10 Dec 2009 01:28:54 +0000 (20:28 -0500)
committerTimo Sirainen <tss@iki.fi>
Thu, 10 Dec 2009 01:28:54 +0000 (20:28 -0500)
If master and auth processes had died, we would never get another connection.

--HG--
branch : HEAD

src/login-common/main.c

index 601327e03e946cf67d11ea1c390f9519503db0ec..0b5104f424268e238cb758bbf6eb945cc8b20e5e 100644 (file)
@@ -27,6 +27,7 @@ struct anvil_client *anvil;
 const struct login_settings *global_login_settings;
 void **global_other_settings;
 
+static bool shutting_down = FALSE;
 static bool ssl_connections = FALSE;
 
 void login_refresh_proctitle(void)
@@ -52,7 +53,13 @@ void login_refresh_proctitle(void)
 
 static void login_die(void)
 {
+       shutting_down = TRUE;
        login_proxy_kill_idle();
+
+       if (auth_client == NULL || !auth_client_is_connected(auth_client)) {
+               /* we don't have auth client, and we might never get one */
+               clients_destroy_all();
+       }
 }
 
 static void client_connected(const struct master_service_connection *conn)
@@ -102,7 +109,9 @@ static void auth_connect_notify(struct auth_client *client ATTR_UNUSED,
                                bool connected, void *context ATTR_UNUSED)
 {
        if (connected)
-                clients_notify_auth_connected();
+               clients_notify_auth_connected();
+       else if (shutting_down)
+               clients_destroy_all();
 }
 
 static bool anvil_reconnect_callback(void)