Module: sip-router Branch: master Commit: 0b8226f9fa7c33eb2716cd79ac4446c1713b6bb5 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0b8226f9...
Author: root root@boyce.voipuser.org Committer: root root@boyce.voipuser.org Date: Sat Oct 2 22:08:22 2010 +0100
dialog(k): fixed db mode realtime
- main proc was reseting the db mode value, resulting in propagation to children if the context switching policy choosed first child init in main proc
---
modules_k/dialog/dialog.c | 7 ++++++- modules_k/dialog/dlg_db_handler.c | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c index 00024a5..7a731ed 100644 --- a/modules_k/dialog/dialog.c +++ b/modules_k/dialog/dialog.c @@ -111,6 +111,8 @@ struct tm_binds d_tmb; struct rr_binds d_rrb; pv_spec_t timeout_avp;
+int dlg_db_mode_param = DB_MODE_NONE; + /* db stuff */ static str db_url = str_init(DEFAULT_DB_URL); static unsigned int db_update_period = DB_DEFAULT_UPDATE_PERIOD; @@ -189,7 +191,7 @@ static param_export_t mod_params[]={ { "dlg_match_mode", INT_PARAM, &seq_match_mode }, { "detect_spirals", INT_PARAM, &detect_spirals, }, { "db_url", STR_PARAM, &db_url.s }, - { "db_mode", INT_PARAM, &dlg_db_mode }, + { "db_mode", INT_PARAM, &dlg_db_mode_param }, { "table_name", STR_PARAM, &dialog_table_name }, { "call_id_column", STR_PARAM, &call_id_column.s }, { "from_uri_column", STR_PARAM, &from_uri_column.s }, @@ -574,6 +576,7 @@ static int mod_init(void) }
/* if a database should be used to store the dialogs' information */ + dlg_db_mode = dlg_db_mode_param; if (dlg_db_mode==DB_MODE_NONE) { db_url.s = 0; db_url.len = 0; } else { @@ -601,6 +604,8 @@ static int mod_init(void)
static int child_init(int rank) { + dlg_db_mode = dlg_db_mode_param; + if (rank==1) { if_update_stat(dlg_enable_stats, active_dlgs, active_dlgs_cnt); if_update_stat(dlg_enable_stats, early_dlgs, early_dlgs_cnt); diff --git a/modules_k/dialog/dlg_db_handler.c b/modules_k/dialog/dlg_db_handler.c index 08d3443..0a6ab04 100644 --- a/modules_k/dialog/dlg_db_handler.c +++ b/modules_k/dialog/dlg_db_handler.c @@ -422,7 +422,9 @@ int remove_dialog_from_db(struct dlg_cell * cell) db_key_t match_keys[2] = { &h_entry_column, &h_id_column};
/*if the dialog hasn 't been yet inserted in the database*/ - LM_DBG("trying to remove a dialog, update_flag is %i\n", cell->dflags); + LM_DBG("trying to remove dialog [%.*s], update_flag is %i\n", + cell->callid.len, cell->callid.s, + cell->dflags); if (cell->dflags & DLG_FLAG_NEW) return 0;