[dovecot-cvs] dovecot/src/auth auth-worker-server.c,1.4,1.5

cras at dovecot.org cras at dovecot.org
Mon Jul 4 00:19:46 EEST 2005


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv9826

Modified Files:
	auth-worker-server.c 
Log Message:
If auth worker socket isn't created yet when we try to connect to it, try
for 5 seconds before aborting.



Index: auth-worker-server.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-worker-server.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- auth-worker-server.c	28 Jun 2005 17:05:47 -0000	1.4
+++ auth-worker-server.c	3 Jul 2005 21:19:44 -0000	1.5
@@ -48,19 +48,27 @@
 static struct auth_worker_connection *auth_worker_create(void)
 {
 	struct auth_worker_connection *conn;
-	int fd;
+	int fd, try;
 
 	if (connections->used / sizeof(conn) >= auth_workers_max)
 		return NULL;
 
-	fd = net_connect_unix(worker_socket_path);
-	if (fd < 0) {
+	for (try = 0;; try++) {
+		fd = net_connect_unix(worker_socket_path);
+		if (fd >= 0)
+			break;
+
 		if (errno != EAGAIN) {
 			i_fatal("net_connect_unix(%s) failed: %m",
 				worker_socket_path);
 		}
-		/* busy */
-		return NULL;
+		if (errno != ENOENT || try == 5) {
+			/* busy / broken */
+			return NULL;
+		}
+
+		/* not created yet? try again */
+		sleep(1);
 	}
 
 	conn = i_new(struct auth_worker_connection, 1);



More information about the dovecot-cvs mailing list