From: Stephan Bosch Date: Sat, 17 Mar 2018 17:10:04 +0000 (+0100) Subject: lib-smtp: test-smtp-payload: Keep the number of pending transactions constant. X-Git-Tag: 2.3.9~1804 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f638d0016f01182d8c6ca8baf43a2e06a7a71786;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: test-smtp-payload: Keep the number of pending transactions constant. Before, a window was used. --- diff --git a/src/lib-smtp/test-smtp-payload.c b/src/lib-smtp/test-smtp-payload.c index 42543fad6f..84558af29a 100644 --- a/src/lib-smtp/test-smtp-payload.c +++ b/src/lib-smtp/test-smtp-payload.c @@ -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;