This allows allocating per-backend module data.
struct mail_user *user = client->user;
struct ssl_iostream_settings ssl_set;
struct smtp_client_settings smtp_set;
+ pool_t pool;
- backend = i_new(struct submission_backend_relay, 1);
- submission_backend_init(&backend->backend, client,
+ pool = pool_alloconly_create("submission relay backend", 1024);
+ backend = p_new(pool, struct submission_backend_relay, 1);
+ submission_backend_init(&backend->backend, pool, client,
&backend_relay_vfuncs);
i_zero(&ssl_set);
smtp_client_transaction_destroy(&backend->trans);
if (backend->conn != NULL)
smtp_client_connection_close(&backend->conn);
- i_free(backend);
}
static void backend_relay_ready_cb(const struct smtp_reply *reply,
#include "submission-backend.h"
void submission_backend_init(struct submission_backend *backend,
- struct client *client,
+ pool_t pool, struct client *client,
const struct submission_backend_vfuncs *vfunc)
{
+ backend->pool = pool;
backend->client = client;
backend->v = *vfunc;
DLLIST_REMOVE(&client->backends, backend);
backend->v.destroy(backend);
+ pool_unref(&backend->pool);
}
void submission_backends_destroy_all(struct client *client)
};
struct submission_backend {
+ pool_t pool;
struct client *client;
struct submission_backend *prev, *next;
};
void submission_backend_init(struct submission_backend *backend,
- struct client *client,
+ pool_t pool, struct client *client,
const struct submission_backend_vfuncs *vfunc);
void submission_backends_destroy_all(struct client *client);