Mercurial > dovecot > core-2.2
changeset 9440:cab8f8009456 HEAD
anvil: Fixed checking what the master connection is.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 04 Jun 2009 12:44:37 -0400 |
parents | 03ef1dd538fe |
children | d43232f22ace |
files | src/anvil/anvil-connection.c src/anvil/anvil-connection.h src/anvil/main.c |
diffstat | 3 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/anvil/anvil-connection.c Wed Jun 03 17:23:24 2009 -0400 +++ b/src/anvil/anvil-connection.c Thu Jun 04 12:44:37 2009 -0400 @@ -27,6 +27,7 @@ unsigned int version_received:1; unsigned int handshaked:1; + unsigned int master:1; }; struct anvil_connection *anvil_connections = NULL; @@ -73,7 +74,7 @@ *error_r = "KILL: Not enough parameters"; return -1; } - if (conn->fd != MASTER_LISTEN_FD_FIRST) { + if (!conn->master) { *error_r = "KILL sent by a non-master connection"; return -1; } @@ -134,7 +135,7 @@ } } -struct anvil_connection *anvil_connection_create(int fd) +struct anvil_connection *anvil_connection_create(int fd, bool master) { struct anvil_connection *conn; @@ -143,6 +144,7 @@ conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE); conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE); conn->io = io_add(fd, IO_READ, anvil_connection_input, conn); + conn->master = master; DLLIST_PREPEND(&anvil_connections, conn); return conn; }
--- a/src/anvil/anvil-connection.h Wed Jun 03 17:23:24 2009 -0400 +++ b/src/anvil/anvil-connection.h Thu Jun 04 12:44:37 2009 -0400 @@ -1,7 +1,7 @@ #ifndef ANVIL_CONNECTION_H #define ANVIL_CONNECTION_H -struct anvil_connection *anvil_connection_create(int fd); +struct anvil_connection *anvil_connection_create(int fd, bool master); void anvil_connection_destroy(struct anvil_connection *conn); void anvil_connections_destroy_all(void);
--- a/src/anvil/main.c Wed Jun 03 17:23:24 2009 -0400 +++ b/src/anvil/main.c Thu Jun 04 12:44:37 2009 -0400 @@ -4,6 +4,7 @@ #include "array.h" #include "env-util.h" #include "master-service.h" +#include "master-interface.h" #include "connect-limit.h" #include "anvil-connection.h" @@ -14,7 +15,9 @@ static void client_connected(const struct master_service_connection *conn) { - anvil_connection_create(conn->fd); + bool master = conn->listen_fd == MASTER_LISTEN_FD_FIRST; + + anvil_connection_create(conn->fd, master); } int main(int argc, char *argv[])