dovecot-2.2: lib-storage: Allow calling storage service's ioloop...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 25 12:50:24 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/a3352c6c483e
changeset: 17840:a3352c6c483e
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 25 15:37:01 2014 +0300
description:
lib-storage: Allow calling storage service's ioloop activate/deactivate functions manually.
diffstat:
src/lib-storage/mail-storage-service.c | 17 +++++++++++------
src/lib-storage/mail-storage-service.h | 9 +++++++++
2 files changed, 20 insertions(+), 6 deletions(-)
diffs (68 lines):
diff -r e588792b4f20 -r a3352c6c483e src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c Thu Sep 25 15:15:20 2014 +0300
+++ b/src/lib-storage/mail-storage-service.c Thu Sep 25 15:37:01 2014 +0300
@@ -695,16 +695,21 @@
return 0;
}
-static void mail_storage_service_io_activate(struct mail_storage_service_user *user)
+void mail_storage_service_io_activate_user(struct mail_storage_service_user *user)
{
i_set_failure_prefix("%s", user->log_prefix);
}
-static void mail_storage_service_io_deactivate(struct mail_storage_service_user *user)
+void mail_storage_service_io_deactivate_user(struct mail_storage_service_user *user)
{
i_set_failure_prefix("%s", user->service_ctx->default_log_prefix);
}
+void mail_storage_service_io_deactivate(struct mail_storage_service_ctx *ctx)
+{
+ i_set_failure_prefix("%s", ctx->default_log_prefix);
+}
+
static void
mail_storage_service_init_log(struct mail_storage_service_ctx *ctx,
struct mail_storage_service_user *user,
@@ -726,8 +731,8 @@
i_set_failure_send_prefix(user->log_prefix);
user->ioloop_ctx = io_loop_context_new(current_ioloop);
io_loop_context_add_callbacks(user->ioloop_ctx,
- mail_storage_service_io_activate,
- mail_storage_service_io_deactivate,
+ mail_storage_service_io_activate_user,
+ mail_storage_service_io_deactivate_user,
user);
}
@@ -1275,8 +1280,8 @@
if (user->ioloop_ctx != NULL) {
io_loop_context_remove_callbacks(user->ioloop_ctx,
- mail_storage_service_io_activate,
- mail_storage_service_io_deactivate, user);
+ mail_storage_service_io_activate_user,
+ mail_storage_service_io_deactivate_user, user);
io_loop_context_unref(&user->ioloop_ctx);
}
settings_parser_deinit(&user->set_parser);
diff -r e588792b4f20 -r a3352c6c483e src/lib-storage/mail-storage-service.h
--- a/src/lib-storage/mail-storage-service.h Thu Sep 25 15:15:20 2014 +0300
+++ b/src/lib-storage/mail-storage-service.h Thu Sep 25 15:37:01 2014 +0300
@@ -109,6 +109,15 @@
const char **username_r);
void mail_storage_service_deinit(struct mail_storage_service_ctx **ctx);
+/* Activate user context. Normally this is called automatically by the ioloop,
+ but e.g. during loops at deinit where all users are being destroyed, it's
+ useful to call this to set the correct user-specific log prefix. */
+void mail_storage_service_io_activate_user(struct mail_storage_service_user *user);
+/* Deactivate user context. This only switches back to non-user-specific
+ log prefix. */
+void mail_storage_service_io_deactivate_user(struct mail_storage_service_user *user);
+void mail_storage_service_io_deactivate(struct mail_storage_service_ctx *ctx);
+
/* Return the settings pointed to by set_root parameter in _init().
The settings contain all the changes done by userdb lookups. */
void **mail_storage_service_user_get_set(struct mail_storage_service_user *user);
More information about the dovecot-cvs
mailing list