From: Timo Sirainen Date: Wed, 3 Feb 2021 23:07:38 +0000 (+0200) Subject: pop3c: Add parent event X-Git-Tag: 2.3.15~154 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=132e9b08d6b1b86c5107539f2b89f184aea5cd78;p=thirdparty%2Fdovecot%2Fcore.git pop3c: Add parent event --- diff --git a/src/lib-storage/index/pop3c/pop3c-client.c b/src/lib-storage/index/pop3c/pop3c-client.c index e2ccb4815d..9fe2d5eea3 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.c +++ b/src/lib-storage/index/pop3c/pop3c-client.c @@ -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); } diff --git a/src/lib-storage/index/pop3c/pop3c-client.h b/src/lib-storage/index/pop3c/pop3c-client.h index 7fb8037769..f0bbd64f9c 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.h +++ b/src/lib-storage/index/pop3c/pop3c-client.h @@ -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, diff --git a/src/lib-storage/index/pop3c/pop3c-storage.c b/src/lib-storage/index/pop3c/pop3c-storage.c index 26931e5314..e6e3d1dcc4 100644 --- a/src/lib-storage/index/pop3c/pop3c-storage.c +++ b/src/lib-storage/index/pop3c/pop3c-storage.c @@ -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