dovecot-2.0: imap, pop3: Small optimization to last logging change.

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 3 07:47:00 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/c9c9ea2bdec9
changeset: 12495:c9c9ea2bdec9
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 03 05:46:57 2010 +0000
description:
imap, pop3: Small optimization to last logging change.
Also added FIXMEs. This is an ugly way to change log prefixes.

diffstat:

 src/imap/imap-client.c |  10 ++++++----
 src/pop3/pop3-client.c |  10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r 8ebf513b875c -r c9c9ea2bdec9 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Fri Dec 03 05:43:16 2010 +0000
+++ b/src/imap/imap-client.c	Fri Dec 03 05:46:57 2010 +0000
@@ -137,6 +137,9 @@
 
 void client_log_start(struct client *client)
 {
+	/* FIXME: This is kind of ugly way to do it here manually. Would be
+	   better if this was integrated to ioloop, so that all io/timeout
+	   callbacks could set the prefixes automatically */
 	if (log_prefix_user != NULL &&
 	    log_prefix_user == client->user)
 		return;
@@ -147,10 +150,9 @@
 
 void client_log_stop(void)
 {
-	if (imap_client_count == 1) {
-		mail_user_set_log_prefix(imap_clients->user);
-		log_prefix_user = imap_clients->user;
-	} else {
+	if (imap_client_count == 1)
+		client_log_start(imap_clients);
+	else {
 		master_service_init_log(master_service, "imap: ");
 		log_prefix_user = NULL;
 	}
diff -r 8ebf513b875c -r c9c9ea2bdec9 src/pop3/pop3-client.c
--- a/src/pop3/pop3-client.c	Fri Dec 03 05:43:16 2010 +0000
+++ b/src/pop3/pop3-client.c	Fri Dec 03 05:46:57 2010 +0000
@@ -46,6 +46,9 @@
 
 static void client_log_start(struct client *client)
 {
+	/* FIXME: This is kind of ugly way to do it here manually. Would be
+	   better if this was integrated to ioloop, so that all io/timeout
+	   callbacks could set the prefixes automatically */
 	if (log_prefix_user != NULL &&
 	    log_prefix_user == client->user)
 		return;
@@ -56,10 +59,9 @@
 
 static void client_log_stop(void)
 {
-	if (pop3_client_count == 1) {
-		mail_user_set_log_prefix(pop3_clients->user);
-		log_prefix_user = pop3_clients->user;
-	} else {
+	if (pop3_client_count == 1)
+		client_log_start(pop3_clients);
+	else {
 		master_service_init_log(master_service, "pop3: ");
 		log_prefix_user = NULL;
 	}


More information about the dovecot-cvs mailing list