]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-client-transaction - Explicitly keep track of whether a recipient...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 9 Feb 2019 11:44:04 +0000 (12:44 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 28 Jun 2019 07:09:29 +0000 (10:09 +0300)
src/lib-smtp/smtp-client-private.h
src/lib-smtp/smtp-client-transaction.c

index 5ca2c20369d5f02a9b811af81c907c90c0e4a8a6..60b5a446184f1b155a6c93293400f56b83aeb0c3 100644 (file)
@@ -92,6 +92,7 @@ struct smtp_client_transaction_rcpt {
        bool external_pool:1;
        bool queued:1;
        bool failed:1;
+       bool finished:1;
 };
 
 struct smtp_client_transaction {
index 9b9c35f5e7f5fd54212296a2e5c9ada40e5e3f92..26df4ecd5d387ecedce33ea650cf9146c0567ddb 100644 (file)
@@ -268,6 +268,10 @@ smtp_client_transaction_rcpt_replied(
        rcpt->rcpt_callback = NULL;
        rcpt->failed = !success;
 
+       if (rcpt->finished)
+               return;
+       rcpt->finished = rcpt->failed;
+
        if (success)
                smtp_client_transaction_rcpt_approved(_rcpt);
        else
@@ -301,6 +305,10 @@ smtp_client_transaction_rcpt_fail_reply(
        smtp_client_command_callback_t *callback;
        void *context;
 
+       if (rcpt->finished)
+               return;
+       rcpt->finished = TRUE;
+
        if (rcpt->queued) {
                callback = rcpt->rcpt_callback;
                context = rcpt->context;
@@ -323,6 +331,9 @@ static void
 smtp_client_transaction_rcpt_finished(struct smtp_client_transaction_rcpt *rcpt,
                                      const struct smtp_reply *reply)
 {
+       i_assert(!rcpt->finished);
+       rcpt->finished = TRUE;
+
        if (rcpt->data_callback != NULL)
                rcpt->data_callback(reply, rcpt->data_context);
        rcpt->data_callback = NULL;
@@ -333,6 +344,8 @@ void smtp_client_transaction_rcpt_set_data_callback(
        struct smtp_client_transaction_rcpt *rcpt,
        smtp_client_command_callback_t *callback, void *context)
 {
+       i_assert(!rcpt->finished);
+
        rcpt->data_callback = callback;
        rcpt->data_context = context;
 }