]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: Rename conn_destroy() callback to conn_free()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 2 Mar 2021 13:23:46 +0000 (15:23 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 11 Mar 2021 11:19:09 +0000 (11:19 +0000)
It's called when the final reference to connection is dropped, so this
describes it better.

src/lib-smtp/smtp-server-connection.c
src/lib-smtp/smtp-server.h
src/lib-smtp/test-smtp-payload.c
src/lib-smtp/test-smtp-server-errors.c
src/lmtp/lmtp-client.c
src/submission-login/client.c
src/submission/submission-client.c

index e4e9ee7f35fa05478ac2f99e180c38b4b7e79f0d..61fe00b5929fdc85d1a11e78aacda2e03b2e6f17 100644 (file)
@@ -1126,8 +1126,8 @@ bool smtp_server_connection_unref(struct smtp_server_connection **_conn)
 
        e_debug(conn->event, "Connection destroy");
 
-       if (conn->callbacks != NULL && conn->callbacks->conn_destroy != NULL)
-               conn->callbacks->conn_destroy(conn->context);
+       if (conn->callbacks != NULL && conn->callbacks->conn_free != NULL)
+               conn->callbacks->conn_free(conn->context);
 
        connection_deinit(&conn->conn);
 
index 30b6d9b5cbf04f006531c979b3c590f562523da0..0e91c6b83593df88108aaa9cedcf411ab7caca52 100644 (file)
@@ -302,8 +302,12 @@ struct smtp_server_callbacks {
        /* Connection */
        int (*conn_start_tls)(void *conn_ctx,
                struct istream **input, struct ostream **output);
+       /* Connection is disconnected. This is always called before
+          conn_free(). */
        void (*conn_disconnect)(void *context, const char *reason);
-       void (*conn_destroy)(void *context);
+       /* The last reference to connection is dropped, causing the connection
+          to be freed. */
+       void (*conn_free)(void *context);
 
        /* Security */
        bool (*conn_is_trusted)(void *context);
index c9dfd795db2592fd81678418bc82fdef01413c14..513a82cfcd574f706f51cfa53c802e3757c58f12 100644 (file)
@@ -377,7 +377,7 @@ test_server_conn_cmd_data_continue(void *conn_ctx ATTR_UNUSED,
 
 /* client connection */
 
-static void test_server_connection_destroy(void *context);
+static void test_server_connection_free(void *context);
 
 static const struct smtp_server_callbacks server_callbacks =
 {
@@ -387,7 +387,7 @@ static const struct smtp_server_callbacks server_callbacks =
 
        .conn_trans_free = test_server_conn_trans_free,
 
-       .conn_destroy = test_server_connection_destroy,
+       .conn_free = test_server_connection_free,
 };
 
 static void client_init(int fd)
@@ -424,7 +424,7 @@ static void client_deinit(struct client **_client)
        pool_unref(&client->pool);
 }
 
-static void test_server_connection_destroy(void *context)
+static void test_server_connection_free(void *context)
 {
        struct client *client = context;
 
index f592a4a5c9aead7496a42e50d8b36a1790c12937..796df210284ab18a6c019d0a7cbbda742fc38743 100644 (file)
@@ -2867,12 +2867,12 @@ static void test_server_defaults(struct smtp_server_settings *smtp_set)
 
 /* client connection */
 
-static void server_connection_destroy(void *context)
+static void server_connection_free(void *context)
 {
        struct server_connection *sconn = (struct server_connection *)context;
 
        if (debug)
-               i_debug("Connection destroyed");
+               i_debug("Connection freed");
 
        if (--server_pending == 0)
                io_loop_stop(ioloop);
@@ -2898,7 +2898,7 @@ static void server_connection_accept(void *context ATTR_UNUSED)
 
        sconn = i_new(struct server_connection, 1);
 
-       server_callbacks.conn_destroy = server_connection_destroy;
+       server_callbacks.conn_free = server_connection_free;
 
        conn = smtp_server_connection_create(smtp_server, fd, fd,
                                             NULL, 0, FALSE, NULL,
index 7cb912687312d34e0212f37b0d81ad706a684683..498367f3d07380c3fc2f27150d6be9c7de71a686 100644 (file)
@@ -379,7 +379,7 @@ static void client_connection_disconnect(void *context, const char *reason)
        client_disconnect(client, NULL, reason);
 }
 
-static void client_connection_destroy(void *context)
+static void client_connection_free(void *context)
 {
        struct client *client = (struct client *)context;
 
@@ -431,7 +431,7 @@ static const struct smtp_server_callbacks lmtp_callbacks = {
        .conn_proxy_data_updated = client_connection_proxy_data_updated,
 
        .conn_disconnect = client_connection_disconnect,
-       .conn_destroy = client_connection_destroy,
+       .conn_free = client_connection_free,
 
        .conn_is_trusted = client_connection_is_trusted
 };
index d2f03a0225c004e5c10d821830ba20c5d03d07d4..43ae9ee7c05bd9928a1b8280f4b7d6b7d2be2127 100644 (file)
@@ -216,7 +216,7 @@ static void client_connection_disconnect(void *context, const char *reason)
        client_disconnect(&client->common, reason);
 }
 
-static void client_connection_destroy(void *context)
+static void client_connection_free(void *context)
 {
        struct submission_client *client = context;
 
@@ -277,7 +277,7 @@ static const struct smtp_server_callbacks smtp_callbacks = {
        .conn_cmd_xclient = client_connection_cmd_xclient,
 
        .conn_disconnect = client_connection_disconnect,
-       .conn_destroy = client_connection_destroy,
+       .conn_free = client_connection_free,
 
        .conn_is_trusted = client_connection_is_trusted
 };
index 877a948caf0b0db667786be54cd199a90ee64f5e..c40f6d34749776d3669f3fda8a4a3be5d0ccbbba 100644 (file)
@@ -406,7 +406,7 @@ static void client_connection_disconnect(void *context, const char *reason)
        client_disconnect(client, NULL, reason);
 }
 
-static void client_connection_destroy(void *context)
+static void client_connection_free(void *context)
 {
        struct client *client = context;
 
@@ -561,7 +561,7 @@ static const struct smtp_server_callbacks smtp_callbacks = {
        .conn_state_changed = client_connection_state_changed,
 
        .conn_disconnect = client_connection_disconnect,
-       .conn_destroy = client_connection_destroy,
+       .conn_free = client_connection_free,
 };
 
 static const struct submission_client_vfuncs submission_client_vfuncs = {