dovecot-2.0-sslstream: auth worker: Don't start breaking if conn...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Feb 13 02:56:22 EET 2010
details: http://hg.dovecot.org/dovecot-2.0-sslstream/rev/1c29c69248e0
changeset: 10319:1c29c69248e0
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 12 18:28:39 2009 -0500
description:
auth worker: Don't start breaking if connection to auth master dies.
diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
src/auth/auth-worker-client.c | 5 +++++
src/auth/auth-worker-client.h | 2 ++
src/auth/main.c | 9 ++++-----
diffs (78 lines):
diff -r 8d47c9dbe9cb -r 1c29c69248e0 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c Thu Nov 12 16:46:55 2009 -0500
+++ b/src/auth/auth-worker-client.c Thu Nov 12 18:28:39 2009 -0500
@@ -32,6 +32,8 @@ struct auth_worker_list_context {
unsigned int id;
bool sending, sent, done;
};
+
+struct auth_worker_client *auth_worker_client;
static void auth_worker_input(struct auth_worker_client *client);
static int auth_worker_output(struct auth_worker_client *client);
@@ -599,6 +601,8 @@ auth_worker_client_create(struct auth *a
client->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
o_stream_set_flush_callback(client->output, auth_worker_output, client);
client->io = io_add(fd, IO_READ, auth_worker_input, client);
+
+ auth_worker_client = client;
return client;
}
@@ -620,6 +624,7 @@ void auth_worker_client_destroy(struct a
client->fd = -1;
auth_worker_client_unref(&client);
+ auth_worker_client = NULL;
master_service_client_connection_destroyed(master_service);
}
diff -r 8d47c9dbe9cb -r 1c29c69248e0 src/auth/auth-worker-client.h
--- a/src/auth/auth-worker-client.h Thu Nov 12 16:46:55 2009 -0500
+++ b/src/auth/auth-worker-client.h Thu Nov 12 18:28:39 2009 -0500
@@ -2,6 +2,8 @@
#define AUTH_WORKER_CLIENT_H
#define AUTH_WORKER_MAX_LINE_LENGTH 8192
+
+extern struct auth_worker_client *auth_worker_client;
struct auth_worker_client *auth_worker_client_create(struct auth *auth, int fd);
void auth_worker_client_destroy(struct auth_worker_client **client);
diff -r 8d47c9dbe9cb -r 1c29c69248e0 src/auth/main.c
--- a/src/auth/main.c Thu Nov 12 16:46:55 2009 -0500
+++ b/src/auth/main.c Thu Nov 12 18:28:39 2009 -0500
@@ -35,7 +35,6 @@ time_t process_start_time;
static struct module *modules = NULL;
static struct auth *auth;
-static struct auth_worker_client *worker_client;
static ARRAY_DEFINE(listen_fd_types, enum auth_socket_type);
static void main_preinit(struct auth_settings *set)
@@ -89,8 +88,8 @@ static void main_init(void)
static void main_deinit(void)
{
- if (worker_client != NULL)
- auth_worker_client_destroy(&worker_client);
+ if (auth_worker_client != NULL)
+ auth_worker_client_destroy(&auth_worker_client);
else
auth_request_handler_flush_failures(TRUE);
@@ -113,12 +112,12 @@ static void main_deinit(void)
static void worker_connected(const struct master_service_connection *conn)
{
- if (worker_client != NULL) {
+ if (auth_worker_client != NULL) {
i_error("Auth workers can handle only a single client");
(void)close(conn->fd);
return;
}
- worker_client = auth_worker_client_create(auth, conn->fd);
+ (void)auth_worker_client_create(auth, conn->fd);
}
static void client_connected(const struct master_service_connection *conn)
More information about the dovecot-cvs
mailing list