]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Don't put connection in TRANSACTION state unless there's a transaction.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 21 Jan 2019 21:21:03 +0000 (22:21 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:02:39 +0000 (10:02 +0200)
Fixes hang occurring when connection is ready before transaction is started.

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

index 1ad65f6d3351f07f69f5926845e80817427f9722..6b6396f657056e7f92c751a588ae45715a7442af 100644 (file)
@@ -2095,10 +2095,13 @@ smtp_client_connection_do_start_transaction(struct smtp_client_connection *conn)
 
        timeout_remove(&conn->to_trans);
 
-       if (conn->transactions_head == NULL)
-               return;
        if (conn->state != SMTP_CLIENT_CONNECTION_STATE_TRANSACTION)
                return;
+       if (conn->transactions_head == NULL) {
+               smtp_client_connection_set_state(conn,
+                       SMTP_CLIENT_CONNECTION_STATE_READY);
+               return;
+       }
 
        if (conn->reset_needed)
                smtp_client_connection_reset(conn);
@@ -2115,6 +2118,8 @@ smtp_client_connection_start_transaction(struct smtp_client_connection *conn)
 {
        if (conn->state != SMTP_CLIENT_CONNECTION_STATE_READY)
                return;
+       if (conn->transactions_head == NULL)
+               return;
        if (conn->to_trans != NULL)
                return;