]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-server-connection - Ignore replied command for pipeline limit calculation.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 24 Jun 2020 09:20:25 +0000 (11:20 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 7 Oct 2020 11:45:27 +0000 (11:45 +0000)
This prevents failed commands with payload from blocking the input pipeline. This caused a hang before.

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

index 66587e72f4909b536505454d00ede4fd6d8dfd51..31bf47b141a8981a49908293e9e625bbe797fd32 100644 (file)
@@ -60,12 +60,19 @@ smtp_server_connection_get_stats(struct smtp_server_connection *conn)
 static bool
 smtp_server_connection_check_pipeline(struct smtp_server_connection *conn)
 {
-       if (conn->command_queue_count >
-           conn->set.max_pipelined_commands) {
+       unsigned int pipeline = conn->command_queue_count;
+
+       if (conn->command_queue_tail != NULL) {
+               i_assert(pipeline > 0);
+               if (conn->command_queue_tail->state ==
+                   SMTP_SERVER_COMMAND_STATE_SUBMITTED_REPLY)
+                       pipeline--;
+       }
+
+       if (pipeline >= conn->set.max_pipelined_commands) {
                e_debug(conn->event, "Command pipeline is full "
                        "(pipelined commands %u > limit %u)",
-                       conn->command_queue_count,
-                       conn->set.max_pipelined_commands);
+                       pipeline, conn->set.max_pipelined_commands);
                return FALSE;
        }
        return TRUE;