]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: test-smtp-server-errors: Implicitly stop server when all expected client...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 8 Apr 2018 13:31:37 +0000 (15:31 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 27 Apr 2018 10:40:00 +0000 (13:40 +0300)
src/lib-smtp/test-smtp-server-errors.c

index e337e50699f69372754ce9b501ee63a91af295d6..6e3a707e155bbfe17695c6fa1caab3ddaf6ffadc 100644 (file)
@@ -55,6 +55,7 @@ static struct smtp_server *smtp_server = NULL;
 static struct io *io_listen;
 static int fd_listen = -1;
 static struct smtp_server_callbacks server_callbacks;
+static unsigned int server_pending;
 
 /* client */
 static pid_t *client_pids = NULL;
@@ -1409,6 +1410,8 @@ static void server_connection_destroy(void *context)
        if (debug)
                i_debug("Connection destroyed");
 
+       if (--server_pending == 0)
+               io_loop_stop(ioloop);
        i_free(sconn);
 }
 
@@ -1574,6 +1577,7 @@ static void test_run_client_server(
 
        i_zero(&server_callbacks);
 
+       server_pending = client_tests_count;
        ioloop = io_loop_create();
        server_test(server_set);
        io_loop_destroy(&ioloop);