Module: sip-router
Branch: master
Commit: ed6ec3be13036cd28dc0df34694f3594a5a6b292
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ed6ec3b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Apr 7 22:54:55 2011 +0200
p_usrloc: use register_dummy_timers() to handle cfg framework updates
- the dummy timer is now created in child_init with rank==PROC_INIT
---
modules_k/p_usrloc/p_usrloc_mod.c | 16 ++++++++++++----
modules_k/p_usrloc/ul_db_watch.c | 2 +-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/modules_k/p_usrloc/p_usrloc_mod.c b/modules_k/p_usrloc/p_usrloc_mod.c
index 6c8c76a..357ce59 100644
--- a/modules_k/p_usrloc/p_usrloc_mod.c
+++ b/modules_k/p_usrloc/p_usrloc_mod.c
@@ -57,6 +57,7 @@
#include "../../sr_module.h"
#include "../../dprint.h"
#include "../../rpc_lookup.h"
+#include "../../timer_proc.h"
#include "../../globals.h" /* is_main */
#include "../../ut.h" /* str_init */
#include "udomain.h" /* {insert,delete,get,release}_urecord */
@@ -435,16 +436,23 @@ static int mod_init(void)
LM_ERR("could not init database watch environment.\n");
return -1;
}
- if(init_db_check() < 0){
- LM_ERR("could not initialise database check.\n");
- return -1;
- }
+ if(db_master_write){
+ /* register extra dummy timer to be created in init_db_check() */
+ register_dummy_timers(1);
+ }
return 0;
}
static int child_init(int _rank)
{
+ if(_rank==PROC_INIT) {
+ if(init_db_check() < 0){
+ LM_ERR("could not initialise database check.\n");
+ return -1;
+ }
+ return 0;
+ }
if(ul_db_child_init() < 0){
LM_ERR("could not initialise databases.\n");
return -1;
diff --git a/modules_k/p_usrloc/ul_db_watch.c b/modules_k/p_usrloc/ul_db_watch.c
index 69cb2da..4d14e30 100644
--- a/modules_k/p_usrloc/ul_db_watch.c
+++ b/modules_k/p_usrloc/ul_db_watch.c
@@ -58,7 +58,7 @@ int init_db_check(void){
int ret;
if(db_master_write){
LM_INFO("start timer, interval %i seconds\n", retry_interval);
- ret = fork_dummy_timer(PROC_TIMER, "TIMER WATCH", 1, check_dbs, NULL,
retry_interval);
+ ret = fork_dummy_timer(PROC_TIMER, "TIMER UL WATCH", 1, check_dbs, NULL,
retry_interval);
} else {
ret = 0;
}