Mercurial > dovecot > core-2.2
changeset 9443:0bf92fe23dea HEAD
Fixed log process after recent lib-master changes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 04 Jun 2009 12:52:14 -0400 |
parents | 97679435f892 |
children | 99a97c5c9912 |
files | src/log/log-connection.c src/log/log-connection.h src/log/main.c |
diffstat | 3 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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 *prev, *next; int fd; + int listen_fd; struct io *io; char *prefix; @@ -160,10 +161,13 @@ 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 @@ } } -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 @@ 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);
--- 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);
--- 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 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[])