dovecot-2.2: lib: Added unix_client_connect_msecs setting to con...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 08:16:35 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/697c6f04baca
changeset: 18869:697c6f04baca
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 16 17:19:12 2015 +0300
description:
lib: Added unix_client_connect_msecs setting to connection API.

diffstat:

 src/lib/connection.c |  4 +++-
 src/lib/connection.h |  3 +++
 2 files changed, 6 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 8076318a7b0e -r 697c6f04baca src/lib/connection.c
--- a/src/lib/connection.c	Tue Jun 16 16:56:08 2015 +0300
+++ b/src/lib/connection.c	Tue Jun 16 17:19:12 2015 +0300
@@ -266,8 +266,10 @@
 
 	if (conn->port != 0)
 		fd = net_connect_ip(&conn->ip, conn->port, NULL);
+	else if (conn->list->set.unix_client_connect_msecs == 0)
+		fd = net_connect_unix(conn->name);
 	else
-		fd = net_connect_unix(conn->name);
+		fd = net_connect_unix_with_retries(conn->name, conn->list->set.unix_client_connect_msecs);
 	if (fd == -1)
 		return -1;
 	conn->fd_in = conn->fd_out = fd;
diff -r 8076318a7b0e -r 697c6f04baca src/lib/connection.h
--- a/src/lib/connection.h	Tue Jun 16 16:56:08 2015 +0300
+++ b/src/lib/connection.h	Tue Jun 16 17:19:12 2015 +0300
@@ -63,6 +63,9 @@
 	   to make the functionality identical with inet sockets, which may
 	   simplify the calling code. */
 	bool delayed_unix_client_connected_callback;
+	/* If connect() to UNIX socket fails with EAGAIN, retry for this many
+	   milliseconds before giving up (0 = try once) */
+	unsigned int unix_client_connect_msecs;
 };
 
 struct connection {


More information about the dovecot-cvs mailing list