Module: sip-router
Branch: master
Commit: c5ca00dc3dba76bfa5d2b35963999ae10db88cf1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c5ca00d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 29 10:23:23 2011 +0200
usrloc(k): use PROC_SIPINIT instead of rank 1 in child_init
- this child is used to load the records from db
---
modules_k/usrloc/ul_mod.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules_k/usrloc/ul_mod.c b/modules_k/usrloc/ul_mod.c
index eaa36e2..17526f9 100644
--- a/modules_k/usrloc/ul_mod.c
+++ b/modules_k/usrloc/ul_mod.c
@@ -360,8 +360,8 @@ static int child_init(int _rank)
LM_ERR("child(%d): failed to connect to database\n", _rank);
return -1;
}
- /* _rank==1 is used even when fork is disabled */
- if (_rank==1 && db_mode!= DB_ONLY) {
+ /* _rank==PROC_SIPINIT is used even when fork is disabled */
+ if (_rank==PROC_SIPINIT && db_mode!= DB_ONLY) {
/* if cache is used, populate domains from DB */
for( ptr=root ; ptr ; ptr=ptr->next) {
if (preload_udomain(ul_dbh, ptr->d) < 0) {
Module: sip-router
Branch: master
Commit: 119ad6aa83a6efed0ffc71eea477e4b5cfbea73b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=119ad6a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 29 10:18:01 2011 +0200
core: added defines for positive child ranks
- PROC_SIPINIT 1 - some modules do specific processing in this child
only, like usrloc loading records from db
- PROC_SIPRPC 127 - special positive rank to use in RPC workers to init
the environment for processing SIP-specific commands. For example,
event_route[tm:local-request] can be executed due to MI/RPC command
and have insite SIP related functions from other modules which need db
connection, like acc_db_request()
---
sr_module.h | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/sr_module.h b/sr_module.h
index 71ffa92..ce8c781 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -204,6 +204,13 @@ typedef int (*param_func_t)( modparam_t type, void* val);
#define PROC_NOCHLDINIT -128 /**< no child init functions will be called
if this rank is used in fork_process() */
+#define PROC_SIPINIT 1 /**< First SIP worker - some modules do special
+ processing in this child, like loading db data */
+#define PROC_SIPRPC 127 /**< Used to init RPC worker as SIP commands
+ handler. Don't do any special processing in the
+ child init with this rank - just bare child
+ initialization */
+
#define PROC_MIN PROC_NOCHLDINIT /**< Minimum process rank */
Module: sip-router
Branch: master
Commit: ab84134e3d34c0ef85c3bb9724796f9c2034f342
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ab84134…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 29 09:33:01 2011 +0200
tm: advertise child rpc-sip mode when using event_route[tm:local-request]
- the event route can be executed for MI/RPC commands that send
requests, thus there are sip routing specific functions that work when
child init for sip workers is executed for that process
- example, calling acc_db_request() requires db connection to be open
---
modules/tm/tm.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index d9b8bbf..5e06470 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -842,6 +842,8 @@ static int mod_init(void)
goto_on_local_req=route_lookup(&event_rt, "tm:local-request");
if (goto_on_local_req>=0 && event_rt.rlist[goto_on_local_req]==0)
goto_on_local_req=-1; /* disable */
+ if (goto_on_local_req>=0)
+ set_child_rpc_sip_mode();
#endif /* WITH_EVENT_LOCAL_REQUEST */
if (goto_on_sl_reply && onreply_rt.rlist[goto_on_sl_reply]==0)
WARN("empty/non existing on_sl_reply route\n");