From: Timo Sirainen Date: Wed, 11 Jan 2023 14:02:38 +0000 (+0200) Subject: lib: Add connection_vfuncs.init() X-Git-Tag: 2.3.21~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3a0ff0ef36525516d6b92b7e90f6b32b60e0ce3;p=thirdparty%2Fdovecot%2Fcore.git lib: Add connection_vfuncs.init() --- diff --git a/src/lib/connection.c b/src/lib/connection.c index dae5c92340..f154f9e58a 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -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, diff --git a/src/lib/connection.h b/src/lib/connection.h index 2dafacc053..612c540558 100644 --- a/src/lib/connection.h +++ b/src/lib/connection.h @@ -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,