dovecot-2.0: Fixed log process after recent lib-master changes.

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 4 19:52:22 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/0bf92fe23dea
changeset: 9443:0bf92fe23dea
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 04 12:52:14 2009 -0400
description:
Fixed log process after recent lib-master changes.

diffstat:

3 files changed, 14 insertions(+), 12 deletions(-)
src/log/log-connection.c |   20 ++++++++++++--------
src/log/log-connection.h |    2 +-
src/log/main.c           |    4 +---

diffs (85 lines):

diff -r 97679435f892 -r 0bf92fe23dea src/log/log-connection.c
--- a/src/log/log-connection.c	Thu Jun 04 12:45:33 2009 -0400
+++ b/src/log/log-connection.c	Thu Jun 04 12:52:14 2009 -0400
@@ -24,6 +24,7 @@ struct log_connection {
 	struct log_connection *prev, *next;
 
 	int fd;
+	int listen_fd;
 	struct io *io;
 
 	char *prefix;
@@ -160,10 +161,13 @@ static bool log_connection_handshake(str
 					handshake.prefix_len);
 		*data += sizeof(handshake) + handshake.prefix_len;
 	}
-	if (strcmp(log->prefix, MASTER_LOG_PREFIX_NAME) == 0 && !log->master) {
-		i_error("Received master prefix in handshake "
-			"from non-master fd %d", log->fd);
-		return FALSE;
+	if (strcmp(log->prefix, MASTER_LOG_PREFIX_NAME) == 0) {
+		if (log->listen_fd != MASTER_LISTEN_FD_FIRST) {
+			i_error("Received master prefix in handshake "
+				"from non-master fd %d", log->fd);
+			return FALSE;
+		}
+		log->master = TRUE;
 	}
 	log->handshaked = TRUE;
 	return TRUE;
@@ -199,17 +203,17 @@ static void log_connection_input(struct 
 	}
 }
 
-struct log_connection *log_connection_create(int fd, bool master)
+struct log_connection *log_connection_create(int fd, int listen_fd)
 {
 	struct log_connection *log;
 
 	log = i_new(struct log_connection, 1);
 	log->fd = fd;
+	log->listen_fd = listen_fd;
 	log->io = io_add(fd, IO_READ, log_connection_input, log);
 	log->clients = hash_table_create(default_pool, default_pool, 0,
 					 NULL, NULL);
-	log->master = master;
-	array_idx_set(&logs_by_fd, fd, &log);
+	array_idx_set(&logs_by_fd, listen_fd, &log);
 
 	DLLIST_PREPEND(&log_connections, log);
 	log_connection_input(log);
@@ -221,7 +225,7 @@ void log_connection_destroy(struct log_c
 	struct hash_iterate_context *iter;
 	void *key, *value;
 
-	array_idx_clear(&logs_by_fd, log->fd);
+	array_idx_clear(&logs_by_fd, log->listen_fd);
 
 	DLLIST_REMOVE(&log_connections, log);
 
diff -r 97679435f892 -r 0bf92fe23dea src/log/log-connection.h
--- a/src/log/log-connection.h	Thu Jun 04 12:45:33 2009 -0400
+++ b/src/log/log-connection.h	Thu Jun 04 12:52:14 2009 -0400
@@ -1,7 +1,7 @@
 #ifndef LOG_CONNECTION_H
 #define LOG_CONNECTION_H
 
-struct log_connection *log_connection_create(int fd, bool master);
+struct log_connection *log_connection_create(int fd, int listen_fd);
 void log_connection_destroy(struct log_connection *log);
 
 void log_connections_init(void);
diff -r 97679435f892 -r 0bf92fe23dea src/log/main.c
--- a/src/log/main.c	Thu Jun 04 12:45:33 2009 -0400
+++ b/src/log/main.c	Thu Jun 04 12:52:14 2009 -0400
@@ -40,9 +40,7 @@ static void main_deinit(void)
 
 static void client_connected(const struct master_service_connection *conn)
 {
-	bool master = conn->listen_fd == MASTER_LISTEN_FD_FIRST;
-
-	log_connection_create(conn->fd, master);
+	log_connection_create(conn->fd, conn->listen_fd);
 }
 
 int main(int argc, char *argv[])


More information about the dovecot-cvs mailing list