Module: kamailio
Branch: master
Commit: 21d4853139523920810a9d73916f3435a5a73d70
URL: 
https://github.com/kamailio/kamailio/commit/21d4853139523920810a9d73916f3435a5a73d70

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-28T08:16:11+01:00

async: added parameter mode

- control if binding to tm should be done or not

---

Modified: src/modules/async/async_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/21d4853139523920810a9d73916f3435a5a73d70.diff
Patch: 
https://github.com/kamailio/kamailio/commit/21d4853139523920810a9d73916f3435a5a73d70.patch

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index 5353082359f..504efa28125 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -43,6 +43,7 @@ MODULE_VERSION
 static int async_workers = 1;
 static int async_ms_timer = 0;
 static int async_return = 0;
+static int async_mode = 0;
 
 static int mod_init(void);
 static int child_init(int);
@@ -97,6 +98,7 @@ static param_export_t params[]={
        {"workers",     PARAM_INT,   &async_workers},
        {"ms_timer",    PARAM_INT,   &async_ms_timer},
        {"return",      PARAM_INT,   &async_return},
+       {"mode",        PARAM_INT,   &async_mode},
        {0, 0, 0}
 };
 
@@ -132,13 +134,18 @@ static int mod_init(void)
                return -1;
        }
 
-       if(load_tm_api(&tmb) == -1) {
-               LM_ERR("cannot load the TM-functions. Missing TM module?\n");
-               return -1;
+       if(async_mode == 0) {
+               if(load_tm_api(&tmb) == -1) {
+                       LM_ERR("cannot load the TM-functions. Missing TM 
module?\n");
+                       return -1;
+               }
+       } else {
+               memset(&tmb, 0, sizeof(struct tm_binds));
        }
 
-       if(async_workers <= 0)
+       if(async_workers <= 0) {
                return 0;
+       }
 
        if(async_init_timer_list() < 0) {
                LM_ERR("cannot initialize internal structure\n");
@@ -173,8 +180,9 @@ static int child_init(int rank)
        if(rank != PROC_MAIN)
                return 0;
 
-       if(async_workers <= 0)
+       if(async_workers <= 0) {
                return 0;
+       }
 
        for(i = 0; i < async_workers; i++) {
                if(fork_basic_timer(PROC_TIMER, "ASYNC MOD TIMER", 1 /*socks 
flag*/,

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to