From: Timo Sirainen Date: Fri, 4 Sep 2009 21:33:00 +0000 (-0400) Subject: imap, pop3: shutdown_clients setting wasn't working. X-Git-Tag: 2.0.alpha1~173 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7cc26a6fd2308906d03baaca8885f39a9d777a43;p=thirdparty%2Fdovecot%2Fcore.git imap, pop3: shutdown_clients setting wasn't working. --HG-- branch : HEAD --- diff --git a/src/imap/main.c b/src/imap/main.c index 627087fad3..14ad317c77 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -36,18 +36,8 @@ static struct client_workaround_list client_workaround_list[] = { { NULL, 0 } }; -static struct io *log_io = NULL; - void (*hook_client_created)(struct client **client) = NULL; -static void log_error_callback(void *context ATTR_UNUSED) -{ - /* the log fd is closed, don't die when trying to log later */ - i_set_failure_ignore_errors(TRUE); - - master_service_stop(master_service); -} - static enum client_workarounds parse_workarounds(const struct imap_settings *set) { @@ -128,11 +118,8 @@ static void main_init(const struct imap_settings *set, struct mail_user *user, struct client *client; struct ostream *output; - if (set->shutdown_clients && !dump_capability) { - /* If master dies, the log fd gets closed and we'll quit */ - log_io = io_add(STDERR_FILENO, IO_ERROR, - log_error_callback, NULL); - } + if (set->shutdown_clients && !dump_capability) + master_service_set_die_with_master(master_service, TRUE); client = client_create(0, 1, user, set); client->workarounds = parse_workarounds(set); @@ -152,8 +139,6 @@ static void main_init(const struct imap_settings *set, struct mail_user *user, static void main_deinit(void) { - if (log_io != NULL) - io_remove(&log_io); clients_destroy_all(); } diff --git a/src/pop3/main.c b/src/pop3/main.c index ebb614651a..a059225937 100644 --- a/src/pop3/main.c +++ b/src/pop3/main.c @@ -21,27 +21,14 @@ void (*hook_client_created)(struct client **client) = NULL; -static struct io *log_io = NULL; - -static void log_error_callback(void *context ATTR_UNUSED) -{ - /* the log fd is closed, don't die when trying to log later */ - i_set_failure_ignore_errors(TRUE); - - master_service_stop(master_service); -} - static bool main_init(const struct pop3_settings *set, struct mail_user *user) { struct client *client; const char *str; bool ret = TRUE; - if (set->shutdown_clients) { - /* If master dies, the log fd gets closed and we'll quit */ - log_io = io_add(STDERR_FILENO, IO_ERROR, - log_error_callback, NULL); - } + if (set->shutdown_clients) + master_service_set_die_with_master(master_service, TRUE); client = client_create(0, 1, user, set); if (client == NULL) @@ -65,8 +52,6 @@ static bool main_init(const struct pop3_settings *set, struct mail_user *user) static void main_deinit(void) { - if (log_io != NULL) - io_remove(&log_io); clients_destroy_all(); }