]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: test-smtp-payload: Keep the number of pending transactions constant.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Mar 2018 17:10:04 +0000 (18:10 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 25 May 2018 20:46:29 +0000 (22:46 +0200)
Before, a window was used.

src/lib-smtp/test-smtp-payload.c

index 42543fad6fd6f70856f1a91af9b02f548449f201..84558af29a3bfda75377fed05451c76dbb271470 100644 (file)
@@ -611,7 +611,7 @@ static void test_client_continue(void *dummy ATTR_UNUSED)
        struct test_client_transaction *tctrans;
        struct smtp_params_mail mail_params;
        const char **paths;
-       unsigned int count;
+       unsigned int count, pending_count, i;
 
        if (debug)
                i_debug("test client: continue");
@@ -627,9 +627,17 @@ static void test_client_continue(void *dummy ATTR_UNUSED)
        for (; client_files_first < client_files_last &&
                paths[client_files_first] == NULL; client_files_first++);
 
+       pending_count = 0;
+       for (i = client_files_first; i < client_files_last; i++) {
+               if (paths[i] != NULL)
+                       pending_count++;
+       }
+
        if (debug) {
-               i_debug("test client: "
-                       "received until [%u/%u]", client_files_first-1, count);
+               i_debug("test client: finished until [%u/%u]; "
+                       "sending until [%u/%u] (%u pending)",
+                       client_files_first-1, count,
+                       client_files_last, count, pending_count);
        }
 
        if (debug && client_files_first < count) {
@@ -645,9 +653,8 @@ static void test_client_continue(void *dummy ATTR_UNUSED)
                return;
        }
 
-       for (; client_files_last < count &&
-                       (client_files_last - client_files_first) < test_max_pending;
-               client_files_last++) {
+       for (; client_files_last < count && pending_count < test_max_pending;
+            client_files_last++, pending_count++) {
                struct istream *fstream, *payload;
                const char *path = paths[client_files_last];
                unsigned int r, rcpts;