[dovecot-cvs] dovecot/src/lib-auth auth-server-connection.c, 1.12, 1.13

cras at dovecot.org cras at dovecot.org
Sun Aug 14 23:39:24 EEST 2005


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

Modified Files:
	auth-server-connection.c 
Log Message:
If UNIX socket connection fails with EAGAIN, try again for a while.



Index: auth-server-connection.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-auth/auth-server-connection.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- auth-server-connection.c	15 Dec 2004 17:52:17 -0000	1.12
+++ auth-server-connection.c	14 Aug 2005 20:39:22 -0000	1.13
@@ -192,9 +192,17 @@
 	struct auth_server_connection *conn;
 	const char *handshake;
 	pool_t pool;
-	int fd;
+	int fd, try;
 
-	fd = net_connect_unix(path);
+	/* max. 1 second wait here. */
+	for (try = 0; try < 10; try++) {
+		fd = net_connect_unix(path);
+		if (fd != -1 || errno != EAGAIN)
+			break;
+
+		/* busy. wait for a while. */
+		usleep(((rand() % 10) + 1) * 10000);
+	}
 	if (fd == -1) {
 		i_error("Can't connect to auth server at %s: %m", path);
 		return NULL;



More information about the dovecot-cvs mailing list