Module: kamailio Branch: master Commit: 461ec0a79ae365729c11efcbd96fc158c50a2891 URL: https://github.com/kamailio/kamailio/commit/461ec0a79ae365729c11efcbd96fc158...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-01-10T18:38:00+01:00
http_async_module: check return for event_base_dispatch()
- exit if it fails - part of GH #2999
---
Modified: src/modules/http_async_client/async_http.c Modified: src/modules/http_async_client/http_async_client_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/461ec0a79ae365729c11efcbd96fc158... Patch: https://github.com/kamailio/kamailio/commit/461ec0a79ae365729c11efcbd96fc158...
---
diff --git a/src/modules/http_async_client/async_http.c b/src/modules/http_async_client/async_http.c index a1b7215fc9..bb5ff69db9 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 8be4747c1d..5829f22b70 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<num_workers; i++) { - LM_DBG("initializing worker notification socket: %d\n", i); + LM_DBG("initializing worker notification socket: %d (rank: %d)\n", i, rank); if(async_http_init_sockets(&workers[i])<0) { LM_ERR("failed to initialize tasks sockets\n"); return -1;