From: Stephan Bosch Date: Thu, 26 Jan 2023 01:34:39 +0000 (+0100) Subject: lib-http: http-client - Make http_client_global_context_free() public for testing. X-Git-Tag: 2.4.0~3031 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76ea8f7de4fbf3501b15285cd00e60cd52da4e82;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client - Make http_client_global_context_free() public for testing. --- diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index 0058d1a030..22c2e1d6d6 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -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( diff --git a/src/lib-http/http-client.h b/src/lib-http/http-client.h index 227376a0fa..7439fe0d16 100644 --- a/src/lib-http/http-client.h +++ b/src/lib-http/http-client.h @@ -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