dovecot-2.0: log, lib-master: More fifo handling fixes.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 4 00:20:03 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/27dfd1f5d46b
changeset: 9438:27dfd1f5d46b
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 03 17:19:53 2009 -0400
description:
log, lib-master: More fifo handling fixes.
diffstat:
4 files changed, 11 insertions(+), 11 deletions(-)
src/lib-master/master-service.c | 2 +-
src/log/log-connection.c | 14 ++++++--------
src/log/log-connection.h | 2 +-
src/log/main.c | 4 +++-
diffs (80 lines):
diff -r e18fb0a361ef -r 27dfd1f5d46b src/lib-master/master-service.c
--- a/src/lib-master/master-service.c Wed Jun 03 17:08:26 2009 -0400
+++ b/src/lib-master/master-service.c Wed Jun 03 17:19:53 2009 -0400
@@ -488,11 +488,11 @@ static void master_service_listen(struct
as the connection fd and stop the listener. */
io_remove(&l->io);
conn.fd = dup(l->fd);
+ conn.listen_fd = l->fd;
if (conn.fd == -1) {
i_error("dup() failed: %m");
return;
}
- io_remove(&l->io);
}
conn.ssl = l->ssl;
net_set_nonblock(conn.fd, TRUE);
diff -r e18fb0a361ef -r 27dfd1f5d46b src/log/log-connection.c
--- a/src/log/log-connection.c Wed Jun 03 17:08:26 2009 -0400
+++ b/src/log/log-connection.c Wed Jun 03 17:19:53 2009 -0400
@@ -160,13 +160,10 @@ static bool log_connection_handshake(str
handshake.prefix_len);
*data += sizeof(handshake) + handshake.prefix_len;
}
- if (strcmp(log->prefix, MASTER_LOG_PREFIX_NAME) == 0) {
- if (log->fd != MASTER_LISTEN_FD_FIRST) {
- i_error("Received master prefix in handshake "
- "from non-master fd %d", log->fd);
- return FALSE;
- }
- log->master = TRUE;
+ 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;
}
log->handshaked = TRUE;
return TRUE;
@@ -202,7 +199,7 @@ static void log_connection_input(struct
}
}
-struct log_connection *log_connection_create(int fd)
+struct log_connection *log_connection_create(int fd, bool master)
{
struct log_connection *log;
@@ -211,6 +208,7 @@ struct log_connection *log_connection_cr
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);
DLLIST_PREPEND(&log_connections, log);
diff -r e18fb0a361ef -r 27dfd1f5d46b src/log/log-connection.h
--- a/src/log/log-connection.h Wed Jun 03 17:08:26 2009 -0400
+++ b/src/log/log-connection.h Wed Jun 03 17:19:53 2009 -0400
@@ -1,7 +1,7 @@
#ifndef LOG_CONNECTION_H
#define LOG_CONNECTION_H
-struct log_connection *log_connection_create(int fd);
+struct log_connection *log_connection_create(int fd, bool master);
void log_connection_destroy(struct log_connection *log);
void log_connections_init(void);
diff -r e18fb0a361ef -r 27dfd1f5d46b src/log/main.c
--- a/src/log/main.c Wed Jun 03 17:08:26 2009 -0400
+++ b/src/log/main.c Wed Jun 03 17:19:53 2009 -0400
@@ -40,7 +40,9 @@ static void main_deinit(void)
static void client_connected(const struct master_service_connection *conn)
{
- log_connection_create(conn->fd);
+ bool master = conn->listen_fd == MASTER_LISTEN_FD_FIRST;
+
+ log_connection_create(conn->fd, master);
}
int main(int argc, char *argv[])
More information about the dovecot-cvs
mailing list