]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: transaction: Move initiation of command submission after starting...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 2 Oct 2018 02:28:10 +0000 (04:28 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Feb 2019 13:40:48 +0000 (15:40 +0200)
This is a precaution against the emergence of segfaults when command submission
somehow terminates the transaction in a future version (actually, a segfault
did emerge in an earlier version of this set of changes). Also it is a cosmetic
change: putting the most important act at the end of the function makes more
sense in this case.

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

index 3e5989227ac5520e3af547d92c2af2d85a1e2bd8..00fdf3b8fa5e4a47883372c52c516ae64295adfd 100644 (file)
@@ -774,15 +774,16 @@ void smtp_client_transaction_send(
        trans->data_callback = data_callback;
        trans->data_context = data_context;
 
-       if (trans->to_send == NULL) {
-               trans->to_send = timeout_add_short(0,
-                       smtp_client_transaction_submit_more, trans);
-       }
        if (trans->finish_timeout_msecs > 0) {
                i_assert(trans->to_finish == NULL);
                trans->to_finish = timeout_add(trans->finish_timeout_msecs,
                        smtp_client_transaction_timeout, trans);
        }
+
+       if (trans->to_send == NULL) {
+               trans->to_send = timeout_add_short(0,
+                       smtp_client_transaction_submit_more, trans);
+       }
 }
 
 static void