]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Added unix_client_connect_msecs setting to connection API.
authorTimo Sirainen <tss@iki.fi>
Tue, 16 Jun 2015 14:19:12 +0000 (17:19 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 16 Jun 2015 14:19:12 +0000 (17:19 +0300)
src/lib/connection.c
src/lib/connection.h

index 202ecf734e73754f7859d047b3df9a7c4650c18c..a1320f673b7ca553b2a22afc35504ee27563650c 100644 (file)
@@ -266,8 +266,10 @@ int connection_client_connect(struct connection *conn)
 
        if (conn->port != 0)
                fd = net_connect_ip(&conn->ip, conn->port, NULL);
-       else
+       else if (conn->list->set.unix_client_connect_msecs == 0)
                fd = net_connect_unix(conn->name);
+       else
+               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;
index f9245c37d98c9b92fc2685041590d3a9106522fb..0d5921457e50ad751028deadf7d7ca70cf60eba4 100644 (file)
@@ -63,6 +63,9 @@ struct connection_settings {
           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 {