]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client-command - Emit smtp_client_command_finished event for replied...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 2 Mar 2019 12:05:08 +0000 (13:05 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 28 Jun 2019 07:09:53 +0000 (10:09 +0300)
This was an omission.

src/lib-smtp/smtp-client-command.c

index f39971f4f2721c93284a32942445e451b0d9e599..8db753441e77aed6da3ea938d54c5ea0ccd38ef6 100644 (file)
@@ -939,7 +939,15 @@ smtp_client_command_input_reply(struct smtp_client_command *cmd,
        i_assert(cmd->replies_seen < cmd->replies_expected);
        finished = (++cmd->replies_seen == cmd->replies_expected);
 
-       e_debug(cmd->event, "Got reply (%u/%u): %s "
+       /* Finish command event at final reply or first failure */
+       struct event_passthrough *e = event_create_passthrough(cmd->event);
+       if (!cmd->event_finished &&
+           (finished || !smtp_reply_is_success(reply))) {
+               e->set_name("smtp_client_command_finished");
+               smtp_reply_add_to_event(reply, e);
+               cmd->event_finished = TRUE;
+       }
+       e_debug(e->event(), "Got reply (%u/%u): %s "
                "(%u commands pending, %u commands queued)",
                cmd->replies_seen, cmd->replies_expected,
                smtp_reply_log(reply), conn->cmd_wait_list_count,