]> 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)
committerMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 17 Jan 2023 11:10:41 +0000 (12:10 +0100)
src/lib/connection.c
src/lib/connection.h

index dae5c92340fcc6e20af2bfebddb2f5d461dc9dda..f154f9e58ad90a646d81c3f5157b9149d9774a18 100644 (file)
@@ -577,6 +577,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,
@@ -608,6 +610,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);
 }
 
@@ -636,6 +640,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,
@@ -654,6 +661,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 2dafacc053742681e4a82d94ba2197c0a744a521..612c5405586c0e50f334fc0e3d6746caa30eab28 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,