]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-client - Make http_client_global_context_free() public for testing.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Thu, 26 Jan 2023 01:34:39 +0000 (02:34 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Jan 2023 19:48:46 +0000 (19:48 +0000)
src/lib-http/http-client.c
src/lib-http/http-client.h

index 0058d1a030c0786f68e47121e81abb333643f542..22c2e1d6d6a890c3f36af1ab898934827e79f868 100644 (file)
@@ -726,8 +726,11 @@ http_client_global_context_ioloop_switched(
        }
 }
 
-static void http_client_global_context_free(void)
+void http_client_global_context_free(void)
 {
+       if (http_client_global_context == NULL)
+               return;
+
        /* Drop ioloop switch callback to make absolutely sure there is no
           recursion. */
        io_loop_remove_switch_callback(
index 227376a0fab289f6be12037a37391518d15256ea..7439fe0d1625e1b560d9d420807dabcf63d55976 100644 (file)
@@ -497,4 +497,8 @@ void http_client_context_unref(struct http_client_context **_cctx);
    returned context. */
 struct http_client_context *http_client_get_global_context(void);
 
+/* Explicitly free the global context. This function is only useful for testing:
+   the global context is cleaned up implicitly. */
+void http_client_global_context_free(void);
+
 #endif