changeset 9879:e11bd2547bb2 HEAD

imap, pop3: shutdown_clients setting wasn't working.
author Timo Sirainen <tss@iki.fi>
date Fri, 04 Sep 2009 17:33:00 -0400
parents c58c40a83bbd
children cce684dfe3e7
files src/imap/main.c src/pop3/main.c
diffstat 2 files changed, 4 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/main.c	Fri Sep 04 17:32:31 2009 -0400
+++ b/src/imap/main.c	Fri Sep 04 17:33:00 2009 -0400
@@ -36,18 +36,8 @@
 	{ 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 @@
 	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_deinit(void)
 {
-	if (log_io != NULL)
-		io_remove(&log_io);
 	clients_destroy_all();
 }
 
--- a/src/pop3/main.c	Fri Sep 04 17:32:31 2009 -0400
+++ b/src/pop3/main.c	Fri Sep 04 17:33:00 2009 -0400
@@ -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 void main_deinit(void)
 {
-	if (log_io != NULL)
-		io_remove(&log_io);
 	clients_destroy_all();
 }