]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
pop3c: Add parent event
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 3 Feb 2021 23:07:38 +0000 (01:07 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 23 Mar 2021 07:40:58 +0000 (07:40 +0000)
src/lib-storage/index/pop3c/pop3c-client.c
src/lib-storage/index/pop3c/pop3c-client.h
src/lib-storage/index/pop3c/pop3c-storage.c

index e2ccb4815de68ad4d82286457ac607315828e983..9fe2d5eea36f3201fec8b5e2968644d10358c542 100644 (file)
@@ -56,6 +56,7 @@ struct pop3c_client_cmd {
 
 struct pop3c_client {
        pool_t pool;
+       struct event *event;
        struct pop3c_client_settings set;
        struct ssl_iostream_context *ssl_ctx;
        struct ip_addr ip;
@@ -90,7 +91,8 @@ static int pop3c_client_ssl_init(struct pop3c_client *client);
 static void pop3c_client_input(struct pop3c_client *client);
 
 struct pop3c_client *
-pop3c_client_init(const struct pop3c_client_settings *set)
+pop3c_client_init(const struct pop3c_client_settings *set,
+                 struct event *event_parent)
 {
        struct pop3c_client *client;
        const char *error;
@@ -99,6 +101,7 @@ pop3c_client_init(const struct pop3c_client_settings *set)
        pool = pool_alloconly_create("pop3c client", 1024);
        client = p_new(pool, struct pop3c_client, 1);
        client->pool = pool;
+       client->event = event_create(event_parent);
        client->fd = -1;
        p_array_init(&client->commands, pool, 16);
 
@@ -210,6 +213,7 @@ void pop3c_client_deinit(struct pop3c_client **_client)
        pop3c_client_disconnect(client);
        if (client->ssl_ctx != NULL)
                ssl_iostream_context_unref(&client->ssl_ctx);
+       event_unref(&client->event);
        pool_unref(&client->pool);
 }
 
index 7fb80377698ad59f28275cbbfed0fc025061535e..f0bbd64f9cfd1d802d6b66eb2be8e2e01600837a 100644 (file)
@@ -49,7 +49,8 @@ typedef void pop3c_cmd_callback_t(enum pop3c_command_state state,
                                  const char *reply, void *context);
 
 struct pop3c_client *
-pop3c_client_init(const struct pop3c_client_settings *set);
+pop3c_client_init(const struct pop3c_client_settings *set,
+                 struct event *event_parent);
 void pop3c_client_deinit(struct pop3c_client **client);
 
 void pop3c_client_login(struct pop3c_client *client,
index 26931e5314589c67369282f3b610e48afc23def2..e6e3d1dcc4fb3f5abe3f9309198e7b5136e9ff97 100644 (file)
@@ -89,7 +89,7 @@ pop3c_client_create_from_set(struct mail_storage *storage,
                client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_STARTTLS;
        else
                client_set.ssl_mode = POP3C_CLIENT_SSL_MODE_NONE;
-       return pop3c_client_init(&client_set);
+       return pop3c_client_init(&client_set, storage->event);
 }
 
 static void