From 461ec0a79ae365729c11efcbd96fc158c50a2891 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 10 Jan 2022 18:33:53 +0100 Subject: [PATCH] http_async_module: check return for event_base_dispatch() - exit if it fails - part of GH #2999 --- src/modules/http_async_client/async_http.c | 7 ++++++- src/modules/http_async_client/http_async_client_mod.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/http_async_client/async_http.c b/src/modules/http_async_client/async_http.c index a1b7215fc9c..bb5ff69db92 100644 --- a/src/modules/http_async_client/async_http.c +++ b/src/modules/http_async_client/async_http.c @@ -48,6 +48,7 @@ #include "../../core/receive.h" #include "../../core/fmsg.h" #include "../../core/kemi.h" +#include "../../core/daemonize.h" #include "../../modules/tm/tm_load.h" #include "async_http.h" @@ -89,8 +90,12 @@ int async_http_init_worker(int prank, async_http_worker_t* worker) void async_http_run_worker(async_http_worker_t* worker) { + int ret; init_http_multi(worker->evbase, worker->g); - event_base_dispatch(worker->evbase); + ret = event_base_dispatch(worker->evbase); + LM_ERR("event base dispatch failed - ret: %d (errno: %d - %s)\n", ret, errno, + strerror(errno)); + ksr_exit(-1); } int async_http_init_sockets(async_http_worker_t *worker) 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 8be4747c1dc..5829f22b708 100644 --- a/src/modules/http_async_client/http_async_client_mod.c +++ b/src/modules/http_async_client/http_async_client_mod.c @@ -325,7 +325,7 @@ static int child_init(int rank) int pid; int i; - LM_DBG("child initializing async http\n"); + LM_DBG("child initializing async http (rank: %d)\n", rank); if(num_workers<=0) return 0; @@ -336,7 +336,7 @@ static int child_init(int rank) if (rank==PROC_INIT) { for(i=0; i