]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3: Show user's proper log prefix when deinitializing users at exit.
authorTimo Sirainen <tss@iki.fi>
Thu, 25 Sep 2014 12:37:48 +0000 (15:37 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 25 Sep 2014 12:37:48 +0000 (15:37 +0300)
src/imap/imap-client.c
src/imap/imap-client.h
src/imap/main.c
src/pop3/main.c
src/pop3/pop3-client.c
src/pop3/pop3-client.h

index 4c1ab273655ac8d99d9abe2ed9af79ad1e625fb6..613c11783a4c8e37c4ca4743681f97f3eba4f88b 100644 (file)
@@ -1111,12 +1111,14 @@ void client_search_updates_free(struct client *client)
        array_clear(&client->search_updates);
 }
 
-void clients_destroy_all(void)
+void clients_destroy_all(struct mail_storage_service_ctx *storage_service)
 {
        while (imap_clients != NULL) {
                client_send_line(imap_clients, "* BYE Server shutting down.");
+               mail_storage_service_io_activate_user(imap_clients->service_user);
                client_destroy(imap_clients, "Server shutting down.");
        }
+       mail_storage_service_io_deactivate(storage_service);
 }
 
 struct imap_client_vfuncs imap_client_vfuncs = {
index 1021d86416539eb0bb73709ca9aa22cc8207a96c..20bba2e6428704cee9b64295b2e59a4518a9627a 100644 (file)
@@ -12,6 +12,7 @@
 
 struct client;
 struct mail_storage;
+struct mail_storage_service_ctx;
 struct imap_parser;
 struct imap_arg;
 struct imap_urlauth_context;
@@ -244,6 +245,6 @@ void client_input(struct client *client);
 bool client_handle_input(struct client *client);
 int client_output(struct client *client);
 
-void clients_destroy_all(void);
+void clients_destroy_all(struct mail_storage_service_ctx *storage_service);
 
 #endif
index 5cf17c60e7ddfc91aad46b4ca536f46a556323d0..5f6a3f7dd5c3d57da1e5692973f3f43c912add94 100644 (file)
@@ -114,6 +114,7 @@ static void imap_die(void)
        for (client = imap_clients; client != NULL; client = next) {
                next = client->next;
 
+               mail_storage_service_io_activate_user(client->service_user);
                last_io = I_MAX(client->last_input, client->last_output);
                if (last_io <= stop_timestamp)
                        client_kill_idle(client);
@@ -124,6 +125,7 @@ static void imap_die(void)
                                                      client_kill_idle, client);
                }
        }
+       mail_storage_service_io_deactivate(storage_service);
 }
 
 struct client_input {
@@ -408,7 +410,7 @@ int main(int argc, char *argv[])
 
        if (io_loop_is_running(current_ioloop))
                master_service_run(master_service, client_connected);
-       clients_destroy_all();
+       clients_destroy_all(storage_service);
 
        if (master_login != NULL)
                master_login_deinit(&master_login);
index 3e7235d5042a7c336d5a0b22ca1ffdc117248d4f..38758a4651fadb78f2e9076ba1714a3fcf86a399 100644 (file)
@@ -275,7 +275,7 @@ int main(int argc, char *argv[])
 
        if (io_loop_is_running(current_ioloop))
                master_service_run(master_service, client_connected);
-       clients_destroy_all();
+       clients_destroy_all(storage_service);
 
        if (master_login != NULL)
                master_login_deinit(&master_login);
index 0da577bc2beea145361acbd5db72c0ace4e6a102..096bf1f1a151acaa3128db6e7cbf695ba7f72f9f 100644 (file)
@@ -837,15 +837,17 @@ static int client_output(struct client *client)
        }
 }
 
-void clients_destroy_all(void)
+void clients_destroy_all(struct mail_storage_service_ctx *storage_service)
 {
        while (pop3_clients != NULL) {
                if (pop3_clients->cmd == NULL) {
                        client_send_line(pop3_clients,
                                "-ERR [SYS/TEMP] Server shutting down.");
                }
+               mail_storage_service_io_activate_user(pop3_clients->service_user);
                client_destroy(pop3_clients, "Server shutting down.");
        }
+       mail_storage_service_io_deactivate(storage_service);
 }
 
 struct pop3_client_vfuncs pop3_client_vfuncs = {
index f8e6c35286e7b6563fc5995763bbb41a29528034..125eeed75c56d2c1dc36183d82ed57a837fd5988 100644 (file)
@@ -5,6 +5,7 @@
 
 struct client;
 struct mail_storage;
+struct mail_storage_service_ctx;
 
 typedef void command_func_t(struct client *client);
 
@@ -133,6 +134,6 @@ void client_send_storage_error(struct client *client);
 bool client_handle_input(struct client *client);
 bool client_update_mails(struct client *client);
 
-void clients_destroy_all(void);
+void clients_destroy_all(struct mail_storage_service_ctx *storage_service);
 
 #endif