dovecot-2.2: lib: connection API: Added delayed_unix_client_conn...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 12 19:00:10 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/6f167f2e550d
changeset: 18656:6f167f2e550d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 12 21:58:03 2015 +0300
description:
lib: connection API: Added delayed_unix_client_connected_callback setting.
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.

diffstat:

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

diffs (40 lines):

diff -r c4bef3533ecd -r 6f167f2e550d src/lib/connection.c
--- a/src/lib/connection.c	Tue May 12 21:52:07 2015 +0300
+++ b/src/lib/connection.c	Tue May 12 21:58:03 2015 +0300
@@ -262,7 +262,8 @@
 		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) {
diff -r c4bef3533ecd -r 6f167f2e550d src/lib/connection.h
--- a/src/lib/connection.h	Tue May 12 21:52:07 2015 +0300
+++ b/src/lib/connection.h	Tue May 12 21:58:03 2015 +0300
@@ -27,8 +27,9 @@
 
 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 @@
 
 	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 {


More information about the dovecot-cvs mailing list