Module: sip-router Branch: master Commit: 879aec4c22202d86b1abf75c428221e72e0a85c5 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=879aec4c22202d86b1abf75c428221e72e0a85c5
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: Mon Apr 14 15:37:33 2014 +0200 async: allow module to start without internal async timer procs - async_route() and async_sleep() will return false - useful when only async_task_route() is used --- modules/async/async_mod.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/modules/async/async_mod.c b/modules/async/async_mod.c index cc838f8..89f204d 100644 --- a/modules/async/async_mod.c +++ b/modules/async/async_mod.c @@ -100,6 +100,9 @@ static int mod_init(void) return -1; } + if(async_workers<=0) + return 0; + if(async_init_timer_list()<0) { LM_ERR("cannot initialize internal structure\n"); return -1; @@ -118,6 +121,9 @@ static int child_init(int rank) if (rank!=PROC_MAIN) return 0; + if(async_workers<=0) + return 0; + if(fork_dummy_timer(PROC_TIMER, "ASYNC MOD TIMER", 1 /*socks flag*/, async_timer_exec, NULL, 1 /*sec*/)<0) { LM_ERR("failed to register timer routine as process\n"); @@ -145,6 +151,12 @@ static int w_async_sleep(struct sip_msg* msg, char* sec, char* str2) if(msg==NULL) return -1; + if(async_workers<=0) + { + LM_ERR("no async mod timer wokers\n"); + return -1; + } + ap = (async_param_t*)sec; if(fixup_get_ivalue(msg, ap->pinterval, &s)!=0) { @@ -203,6 +215,12 @@ static int w_async_route(struct sip_msg* msg, char* rt, char* sec) if(msg==NULL) return -1; + if(async_workers<=0) + { + LM_ERR("no async mod timer wokers\n"); + return -1; + } + if(fixup_get_svalue(msg, (gparam_t*)rt, &rn)!=0) { LM_ERR("no async route block name\n"); _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
