Skip to content

Commit

Permalink
lib-smtp: smtp-client-connection - Create separate parent event to ad…
Browse files Browse the repository at this point in the history
…d the smtp-client log prefix.

This is needed for a later commit that moves the addition of the connection log
prefix to the connection API.
  • Loading branch information
stephanbosch committed Mar 1, 2019
1 parent 95b3b93 commit 2c67ab2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/lib-smtp/smtp-client-connection.c
Expand Up @@ -1737,6 +1737,7 @@ smtp_client_connection_do_create(struct smtp_client *client, const char *name,
const struct smtp_client_settings *set)
{
struct smtp_client_connection *conn;
struct event *conn_event;
pool_t pool;

pool = pool_alloconly_create("smtp client connection", 2048);
Expand Down Expand Up @@ -1826,21 +1827,25 @@ smtp_client_connection_do_create(struct smtp_client *client, const char *name,
("smtp client connection capabilities", 128);

if (set != NULL && set->event != NULL)
conn->event = event_create(set->event);
conn_event = event_create(set->event);
else
conn->event = event_create(client->event);
event_set_forced_debug(conn->event, (set != NULL && set->debug));
event_add_str(conn->event, "protocol",
conn_event = event_create(client->event);
event_set_append_log_prefix(
conn_event,
t_strdup_printf("%s-client: ",
smtp_protocol_name(conn->protocol)));
event_add_str(conn_event, "protocol",
smtp_protocol_name(conn->protocol));
event_set_forced_debug(conn_event, (set != NULL && set->debug));

conn->event = event_create(conn_event);

conn->conn.event_parent = conn->event;
connection_init(conn->client->conn_list, &conn->conn, name);
event_unref(&conn_event);

event_set_append_log_prefix(
conn->event,
t_strdup_printf("%s-client: conn %s: ",
smtp_protocol_name(conn->protocol),
conn->conn.label));
conn->event, t_strdup_printf("conn %s: ", conn->conn.label));

return conn;
}
Expand Down

0 comments on commit 2c67ab2

Please sign in to comment.