diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c index d6400d56619..6157e2ad19e 100644 --- a/modules/dialog/dialog.c +++ b/modules/dialog/dialog.c @@ -909,10 +909,6 @@ static int mod_init(void) -static void rpc_load_dlg_db(int sender, void *param) -{ - load_dlg_db(dlg_hash_size); -} static int child_init(int rank) { @@ -925,10 +921,6 @@ static int child_init(int rank) LM_ERR("failed to connect to database (rank=%d)\n",rank); return -1; } - if (rank == 1 && ipc_dispatch_rpc(rpc_load_dlg_db, NULL) < 0) { - LM_CRIT("failed to RPC the dialogs loading\n"); - return -1; - } } if (cdb_url.s && cdb_url.len && init_cachedb() < 0) { diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index 6643e567690..62b0f8b418b 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -184,9 +184,6 @@ int init_dlg_db(const str *db_url, int dlg_hash_size , int db_update_period) return -1; } - dialog_dbf.close(dialog_db_handle); - dialog_db_handle = 0; - if (dlg_db_mode == DB_MODE_DELAYED) { if (register_timer("dlg-dbupdate",dialog_update_db, (void*)(unsigned long)1 /*do locking*/, @@ -196,16 +193,19 @@ int init_dlg_db(const str *db_url, int dlg_hash_size , int db_update_period) } } - return 0; -} - -void load_dlg_db(int dlg_hash_size) -{ - if( (load_dialog_info_from_db(dlg_hash_size) ) ==0 ){ - if (dlg_db_mode==DB_MODE_SHUTDOWN && remove_all_dialogs_from_db()!=0) - LM_WARN("failed to properly remove all the dialogs form DB\n"); - } else + if( (load_dialog_info_from_db(dlg_hash_size) ) !=0 ){ LM_ERR("unable to load the dialog data\n"); + return -1; + } + + if (dlg_db_mode==DB_MODE_SHUTDOWN && remove_all_dialogs_from_db()!=0) { + LM_WARN("failed to properly remove all the dialogs form DB\n"); + } + + dialog_dbf.close(dialog_db_handle); + dialog_db_handle = 0; + + return 0; } diff --git a/modules/dialog/dlg_db_handler.h b/modules/dialog/dlg_db_handler.h index 14dda8a3d82..8141001b0f8 100644 --- a/modules/dialog/dlg_db_handler.h +++ b/modules/dialog/dlg_db_handler.h @@ -104,7 +104,6 @@ extern int db_flush_vp; #define should_remove_dlg_db() (dlg_db_mode==DB_MODE_REALTIME) -void load_dlg_db(int dlg_hash_size); int init_dlg_db(const str *db_url, int dlg_hash_size, int db_update_period); int dlg_connect_db(const str *db_url); void destroy_dlg_db();