]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ldap: ldap_client - Add event
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 10 Oct 2024 12:01:56 +0000 (12:01 +0000)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:15 +0000 (12:34 +0200)
src/lib-ldap/ldap-client.c
src/lib-ldap/ldap-connection.c
src/lib-ldap/ldap-private.h

index bbae9106aa678fa64462412f552b296cff85630d..7642f53881b84028ac9c35f3ed3eb4084d00f8c5 100644 (file)
@@ -10,6 +10,7 @@
 #define LDAP_CONN_POOL_MAX_CONNECTIONS UINT_MAX
 
 struct ldap_client {
+       struct event *event;
        struct ldap_connection_list *list;
 };
 
@@ -24,6 +25,7 @@ int ldap_client_init(const struct ldap_client_settings *set,
                ldap_conn_pool = ldap_connection_pool_init(LDAP_CONN_POOL_MAX_CONNECTIONS);
 
        client = i_new(struct ldap_client, 1);
+       client->event = event_create(set->event_parent);
        if (ldap_connection_pool_get(ldap_conn_pool, client, set,
                                     &client->list, error_r) < 0) {
                i_free(client);
@@ -40,9 +42,15 @@ void ldap_client_deinit(struct ldap_client **_client)
        *_client = NULL;
 
        ldap_connection_pool_unref(ldap_conn_pool, &client->list);
+       event_unref(&client->event);
        i_free(client);
 }
 
+struct event *ldap_client_get_event(struct ldap_client *client)
+{
+       return client->event;
+}
+
 void ldap_client_switch_ioloop(struct ldap_client *client)
 {
        ldap_connection_switch_ioloop(client->list->conn);
index aa820d02f207295f78f581d30bc7bd46e61d5459..bdc8d1600b3c22fa6a9d46fc7af158507b88b4a0 100644 (file)
@@ -170,7 +170,7 @@ int ldap_connection_init(struct ldap_client *client,
        pool_t pool = pool_alloconly_create("ldap connection", 1024);
        struct ldap_connection *conn = p_new(pool, struct ldap_connection, 1);
        conn->pool = pool;
-       conn->event = event_create(set->event_parent);
+       conn->event = event_create(ldap_client_get_event(client));
 
        conn->client = client;
        conn->set = *set;
index ec40f1c550b3302e4deea40d5975b17e03d1e4e9..5c3a4abaa26e466b0589a0d32e956599389df222 100644 (file)
@@ -120,6 +120,7 @@ void ldap_connection_compare_start(struct ldap_connection *conn,
 void ldap_connection_kill(struct ldap_connection *conn);
 int ldap_connection_check(struct ldap_connection *conn);
 void ldap_connection_queue_request(struct ldap_connection *conn, struct ldap_op_queue_entry *req);
+struct event *ldap_client_get_event(struct ldap_client *client);
 
 int ldap_entry_init(struct ldap_entry *obj, struct ldap_result *result, LDAPMessage *message);