Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4966:5df66ce64c0c HEAD
If no auth sockets are found in 10 seconds, kill ourself.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 28 Dec 2006 17:21:55 +0200 |
parents | 9246d9308caa |
children | 1104fc097321 |
files | src/lib-auth/auth-client.c src/lib-auth/auth-server-connection.h |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-auth/auth-client.c Thu Dec 28 17:06:31 2006 +0200 +++ b/src/lib-auth/auth-client.c Thu Dec 28 17:21:55 2006 +0200 @@ -10,6 +10,8 @@ #include <dirent.h> #include <sys/stat.h> +#define AUTH_CLIENT_SOCKET_MAX_WAIT_TIME 10 + struct auth_client *auth_client_new(unsigned int client_pid) { struct auth_client *client; @@ -147,13 +149,21 @@ } } + if (client->connections == NULL && !client->reconnect) { + if (client->missing_sockets_start_time == 0) + client->missing_sockets_start_time = ioloop_time; + else if (ioloop_time - client->missing_sockets_start_time > + AUTH_CLIENT_SOCKET_MAX_WAIT_TIME) + i_fatal("No authentication sockets found"); + } + if (closedir(dirp) < 0) i_error("closedir() failed: %m"); if (client->reconnect || client->connections == NULL) { if (client->to_reconnect == NULL) { client->to_reconnect = - timeout_add(5000, reconnect_timeout, client); + timeout_add(1000, reconnect_timeout, client); } } else if (client->to_reconnect != NULL) timeout_remove(&client->to_reconnect);
--- a/src/lib-auth/auth-server-connection.h Thu Dec 28 17:06:31 2006 +0200 +++ b/src/lib-auth/auth-server-connection.h Thu Dec 28 17:21:55 2006 +0200 @@ -7,6 +7,7 @@ struct auth_server_connection *connections; struct timeout *to_reconnect; + time_t missing_sockets_start_time; unsigned int conn_waiting_handshake_count; buffer_t *available_auth_mechs;