Module: sip-router Branch: master Commit: 76266ca085d05be949ddc34df513de6810c5d65f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=76266ca0...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Thu Jul 1 18:31:14 2010 +0200
drouting: check if db connection is initialized
- applied for the case of mi reload command
---
modules_k/drouting/drouting.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/modules_k/drouting/drouting.c b/modules_k/drouting/drouting.c index 6d24a16..45f36c2 100644 --- a/modules_k/drouting/drouting.c +++ b/modules_k/drouting/drouting.c @@ -475,6 +475,15 @@ static struct mi_root* dr_reload_cmd(struct mi_root *cmd_tree, void *param)
LM_INFO(""%s" MI command received!\n",RELOAD_MI_CMD);
+ /* init DB connection if needed */ + if (db_hdl==NULL) { + db_hdl=dr_dbf.init(&db_url); + if(db_hdl==0 ) { + LM_CRIT("cannot initialize database connection\n"); + goto error; + } + } + if ( (n=dr_reload_data())!=0 ) { LM_CRIT("failed to load routing data\n"); goto error;