]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: connection API: Added delayed_unix_client_connected_callback setting.
authorTimo Sirainen <tss@iki.fi>
Tue, 12 May 2015 18:58:03 +0000 (21:58 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 12 May 2015 18:58:03 +0000 (21:58 +0300)
092a51d80bad commit changed this functionality first to fix lib-http code,
but it broke other code. 1fac17a2bc53 reversed the original behavior.
This change allows either behavior optionally.

src/lib/connection.c
src/lib/connection.h

index 191ee6092111f97eca9791580a4bbbf8708bd622..5f872bc7dfedcde885e2a82c73187b715a750f17 100644 (file)
@@ -262,7 +262,8 @@ int connection_client_connect(struct connection *conn)
                return -1;
        conn->fd_in = conn->fd_out = fd;
 
-       if (conn->port != 0) {
+       if (conn->port != 0 ||
+           conn->list->set.delayed_unix_client_connected_callback) {
                conn->io = io_add(conn->fd_out, IO_WRITE,
                                  connection_socket_connected, conn);
                if (set->client_connect_timeout_msecs != 0) {
index 02c1de87e43580e5311aac25822c3cf12277f9c0..f9245c37d98c9b92fc2685041590d3a9106522fb 100644 (file)
@@ -27,8 +27,9 @@ enum connection_disconnect_reason {
 
 struct connection_vfuncs {
        void (*destroy)(struct connection *conn);
-       /* For UNIX socket clients this gets called immediately with
-          success=TRUE, for IP connections it gets called later:
+       /* For UNIX socket clients this gets called immediately (unless
+          delayed_unix_client_connected_callback=TRUE) with success=TRUE,
+          for IP connections it gets called later:
 
           If connect() fails, sets success=FALSE and errno. Streams aren't
           initialized in that situation either. destroy() is called after
@@ -57,6 +58,11 @@ struct connection_settings {
 
        bool client;
        bool dont_send_version;
+       /* Don't call client_connected() immediately on
+          connection_client_connect() with UNIX sockets. This is mainly
+          to make the functionality identical with inet sockets, which may
+          simplify the calling code. */
+       bool delayed_unix_client_connected_callback;
 };
 
 struct connection {