]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Uncork and flush the output stream explicitly after sending commands.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Feb 2018 09:26:30 +0000 (10:26 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Feb 2018 14:49:41 +0000 (15:49 +0100)
This allows detecting any output stream errors.

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

index 33e3919cfd70db312b516feee77e7fe1d1bb4f41..8de8ffc4dbe6e5366d6577136bc68be58b485d44 100644 (file)
@@ -1080,8 +1080,13 @@ static int smtp_client_connection_output(struct smtp_client_connection *conn)
        }
 
        smtp_client_connection_ref(conn);
+       o_stream_cork(conn->conn.output);
        if (smtp_client_command_send_more(conn) < 0)
                ret = -1;
+       if (ret >= 0 && conn->conn.output != NULL && !conn->corked) {
+               if (o_stream_uncork_flush(conn->conn.output) < 0)
+                       smtp_client_connection_handle_output_error(conn);
+       }
        smtp_client_connection_unref(&conn);
        return ret;
 }