From: Timo Sirainen Date: Thu, 25 Sep 2014 12:37:48 +0000 (+0300) Subject: imap, pop3: Show user's proper log prefix when deinitializing users at exit. X-Git-Tag: 2.2.14.rc1~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2df651ae18342cbe72c92d5489af5fc582b65937;p=thirdparty%2Fdovecot%2Fcore.git imap, pop3: Show user's proper log prefix when deinitializing users at exit. --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 4c1ab27365..613c11783a 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -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 = { diff --git a/src/imap/imap-client.h b/src/imap/imap-client.h index 1021d86416..20bba2e642 100644 --- a/src/imap/imap-client.h +++ b/src/imap/imap-client.h @@ -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 diff --git a/src/imap/main.c b/src/imap/main.c index 5cf17c60e7..5f6a3f7dd5 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -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); diff --git a/src/pop3/main.c b/src/pop3/main.c index 3e7235d504..38758a4651 100644 --- a/src/pop3/main.c +++ b/src/pop3/main.c @@ -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); diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index 0da577bc2b..096bf1f1a1 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -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 = { diff --git a/src/pop3/pop3-client.h b/src/pop3/pop3-client.h index f8e6c35286..125eeed75c 100644 --- a/src/pop3/pop3-client.h +++ b/src/pop3/pop3-client.h @@ -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