]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add connection_vfuncs.init()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 11 Jan 2023 14:02:38 +0000 (16:02 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 13 Jan 2023 12:16:26 +0000 (12:16 +0000)
src/lib/connection.c
src/lib/connection.h

index bb9d181ff3c5abb9bac64eea7c27151712963570..1ffb0415af0710c28ba57603dbdbee131cb3755b 100644 (file)
@@ -591,6 +591,8 @@ void connection_init_server(struct connection_list *list,
        e_debug(e->event(), "Server accepted connection (fd=%d)", fd_in);
 
        connection_init_streams(conn);
+       if (conn->v.init != NULL)
+               conn->v.init(conn);
 }
 
 void connection_init_server_ip(struct connection_list *list,
@@ -622,6 +624,8 @@ void connection_init_client_fd(struct connection_list *list,
           also be obvious that fd_out=1. */
        e_debug(e->event(), "Client connected (fd=%d)", fd_in);
 
+       if (conn->v.init != NULL)
+               conn->v.init(conn);
        connection_client_connected(conn, TRUE);
 }
 
@@ -650,6 +654,9 @@ void connection_init_client_ip_from(struct connection_list *list,
        if (hostname != NULL)
                event_add_str(conn->event, "dest_host", hostname);
        connection_update_event(conn);
+
+       if (conn->v.init != NULL)
+               conn->v.init(conn);
 }
 
 void connection_init_client_ip(struct connection_list *list,
@@ -668,6 +675,9 @@ void connection_init_client_unix(struct connection_list *list,
 
        connection_init(list, conn, path);
        event_add_str(conn->event, "socket_path", path);
+
+       if (conn->v.init != NULL)
+               conn->v.init(conn);
 }
 
 void connection_init_from_streams(struct connection_list *list,
index 4bd836e2c9d1f228ffdeeb325af9366bfc99717e..1ed112f950399cc454d8ad77246954565105e7f4 100644 (file)
@@ -29,6 +29,7 @@ enum connection_disconnect_reason {
 };
 
 struct connection_vfuncs {
+       void (*init)(struct connection *conn);
        void (*destroy)(struct connection *conn);
        /* For UNIX socket clients this gets called immediately (unless
           delayed_unix_client_connected_callback=TRUE) with success=TRUE,