Mercurial > dovecot > core-2.2
changeset 18656:6f167f2e550d
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 12 May 2015 21:58:03 +0300 |
parents | c4bef3533ecd |
children | 2c1ce55de520 |
files | src/lib/connection.c src/lib/connection.h |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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) {
--- 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 {