]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Add director_connection.event
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 20 Aug 2020 13:07:00 +0000 (16:07 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 21 Aug 2020 06:10:21 +0000 (06:10 +0000)
src/director/director-connection.c

index 4585fa8ed6d59f330908ddc0fb6cba62529a492d..05dc4b039f683ea69ded78743ea4fe28ee2d2619 100644 (file)
@@ -99,6 +99,7 @@
 struct director_connection {
        int refcount;
        struct director *dir;
+       struct event *event;
        char *name;
        struct timeval created, connected_time, me_received_time;
        struct timeval connected_user_cpu;
@@ -164,6 +165,9 @@ director_connection_set_name(struct director_connection *conn, const char *name)
        char *old_name = conn->name;
        conn->name = i_strdup(name);
        i_free(old_name);
+
+       event_set_append_log_prefix(conn->event,
+               t_strdup_printf("director(%s): ", conn->name));
 }
 
 static void ATTR_FORMAT(2, 3)
@@ -2293,6 +2297,7 @@ director_connection_init_common(struct director *dir, int fd)
        conn->created = ioloop_timeval;
        conn->fd = fd;
        conn->dir = dir;
+       conn->event = event_create(dir->event);
        conn->input = i_stream_create_fd(conn->fd, MAX_INBUF_SIZE);
        conn->output = o_stream_create_fd(conn->fd, dir->set->director_output_buffer_size);
        o_stream_set_no_error_handling(conn->output, TRUE);
@@ -2502,6 +2507,7 @@ static bool director_connection_unref(struct director_connection *conn)
                director_host_unref(conn->host);
        i_stream_unref(&conn->input);
        o_stream_unref(&conn->output);
+       event_unref(&conn->event);
        i_free(conn->name);
        i_free(conn);
        return FALSE;