]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: test-http-payload - Switch ioloop implicitly using callback
authorStephan Bosch <stephan.bosch@open-xchange.com>
Fri, 21 May 2021 11:16:54 +0000 (13:16 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 7 Mar 2025 14:56:56 +0000 (14:56 +0000)
src/lib-http/test-http-payload.c

index 56fa767aed2f9fa481a122eb07c9078825a4c394..ada971dcd14b6a0c9300b7c34af4c2d0dd229e7d 100644 (file)
@@ -930,10 +930,12 @@ static void test_client_request_destroy(struct test_client_request *tcreq)
        test_client_request_unref(&tcreq);
 }
 
-static void test_client_switch_ioloop(void)
+static void test_client_switch_ioloop(struct ioloop *prev_ioloop ATTR_UNUSED)
 {
        struct test_client_request *tcreq;
 
+       e_debug(client_event, "switch ioloop");
+
        if (to_continue != NULL)
                to_continue = io_loop_move_timeout(&to_continue);
        if (to_client_progress != NULL)
@@ -964,6 +966,8 @@ static void test_client_init(void)
                        CLIENT_PROGRESS_TIMEOUT*1000,
                        test_client_progress_timeout, NULL);
        }
+
+       io_loop_add_switch_callback(test_client_switch_ioloop);
 }
 
 static void test_client_deinit(void)
@@ -976,6 +980,7 @@ static void test_client_deinit(void)
 
        tset.parallel_clients = 1;
 
+       io_loop_remove_switch_callback(test_client_switch_ioloop);
        timeout_remove(&to_continue);
        timeout_remove(&to_client_progress);
 
@@ -1623,14 +1628,12 @@ static void test_client_echo_continue(void *context ATTR_UNUSED)
                ioloop_nested = io_loop_create();
                for (i = 0; i < tset.parallel_clients; i++)
                        http_client_switch_ioloop(http_clients[i]);
-               test_client_switch_ioloop();
 
                io_loop_run(ioloop_nested);
 
                io_loop_set_current(prev_ioloop);
                for (i = 0; i < tset.parallel_clients; i++)
                        http_client_switch_ioloop(http_clients[i]);
-               test_client_switch_ioloop();
                io_loop_set_current(ioloop_nested);
                io_loop_destroy(&ioloop_nested);
                ioloop_nested = NULL;