[sr-dev] git:master:3d0e1f79: dialog: run run_load_callbacks() on child_init for rank PROC_INIT

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 2 00:17:13 CEST 2018


Module: kamailio
Branch: master
Commit: 3d0e1f796eb359689b75eebbb04cd09c6ee6807a
URL: https://github.com/kamailio/kamailio/commit/3d0e1f796eb359689b75eebbb04cd09c6ee6807a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-08-02T00:16:26+02:00

dialog: run run_load_callbacks() on child_init for rank PROC_INIT

- proper test for create_cbs
- based on PR #1606 and #1607 by kosza

---

Modified: src/modules/dialog/dialog.c
Modified: src/modules/dialog/dlg_cb.c

---

Diff:  https://github.com/kamailio/kamailio/commit/3d0e1f796eb359689b75eebbb04cd09c6ee6807a.diff
Patch: https://github.com/kamailio/kamailio/commit/3d0e1f796eb359689b75eebbb04cd09c6ee6807a.patch

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 84262ea25f..a7efe2d7e9 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -711,7 +711,6 @@ static int mod_init(void)
 			LM_ERR("failed to initialize the DB support\n");
 			return -1;
 		}
-		run_load_callbacks();
 	}
 
 	destroy_dlg_callbacks( DLGCB_LOADED );
@@ -742,6 +741,13 @@ static int child_init(int rank)
 {
 	dlg_db_mode = dlg_db_mode_param;
 
+
+	if(rank==PROC_INIT) {
+		if (dlg_db_mode!=DB_MODE_NONE) {
+			run_load_callbacks();
+		}
+	}
+
 	if(rank==PROC_MAIN) {
 		if(dlg_timer_procs>0) {
 			if(fork_sync_timer(PROC_TIMER, "Dialog Main Timer", 1 /*socks flag*/,
diff --git a/src/modules/dialog/dlg_cb.c b/src/modules/dialog/dlg_cb.c
index 6ba48513ec..12946994ba 100644
--- a/src/modules/dialog/dlg_cb.c
+++ b/src/modules/dialog/dlg_cb.c
@@ -133,7 +133,7 @@ int register_dlgcb(struct dlg_cell *dlg, int types, dialog_cb f,
 	cb->callback_param_free = ff;
 
 	if ( types==DLGCB_CREATED ) {
-		if (load_cbs==POINTER_CLOSED_MARKER) {
+		if (create_cbs==POINTER_CLOSED_MARKER) {
 			LM_CRIT("DLGCB_CREATED type registered after shutdown!?!\n");
 			goto error;
 		}




More information about the sr-dev mailing list