From bc4c206999094ed74e77c73f5537e857111d0a30 Mon Sep 17 00:00:00 2001 From: S-P Chan Date: Tue, 27 Feb 2024 12:38:09 +0800 Subject: [PATCH] http_async_client: libssl refactor thread executors for curl Cherry-pick from 6a0c86bba8 --- src/modules/http_async_client/http_async_client_mod.c | 5 ++++- src/modules/http_async_client/http_multi.c | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/http_async_client/http_async_client_mod.c b/src/modules/http_async_client/http_async_client_mod.c index 983a9e387f1..97a5c5dd420 100644 --- a/src/modules/http_async_client/http_async_client_mod.c +++ b/src/modules/http_async_client/http_async_client_mod.c @@ -50,6 +50,9 @@ #include "../../core/cfg/cfg_struct.h" #include "../../core/fmsg.h" #include "../../core/kemi.h" +#define KSR_RTHREAD_NEED_V +#define KSR_RTHREAD_SKIP_P +#include "../../core/rthreads.h" #include "../../modules/tm/tm_load.h" #include "../../modules/pv/pv_api.h" @@ -285,7 +288,7 @@ static int mod_init(void) return -1; } - set_curl_mem_callbacks(); + run_threadV((_thread_protoV)&set_curl_mem_callbacks); /* init faked sip msg */ if(faked_msg_init() < 0) { diff --git a/src/modules/http_async_client/http_multi.c b/src/modules/http_async_client/http_multi.c index a0ee1c877cf..a57aba9c951 100644 --- a/src/modules/http_async_client/http_multi.c +++ b/src/modules/http_async_client/http_multi.c @@ -32,9 +32,6 @@ #include "../../core/mem/mem.h" #include "../../core/ut.h" #include "../../core/hashes.h" -#define KSR_RTHREAD_NEED_4L -#define KSR_RTHREAD_SKIP_P -#include "../../core/rthreads.h" #include "http_multi.h" extern int hash_size; @@ -392,8 +389,7 @@ void set_curl_mem_callbacks(void) break; case 1: LM_DBG("Initilizing cURL with sys malloc\n"); - rc = run_thread4L( - (_thread_proto4L)curl_global_init, CURL_GLOBAL_ALL); + rc = curl_global_init(CURL_GLOBAL_ALL); if(rc != 0) { LM_ERR("Cannot initialize cURL: %d\n", rc); }