Module: kamailio
Branch: master
Commit: 1ff86ffceede46c7a67fec92c8319c34c916a545
URL:
https://github.com/kamailio/kamailio/commit/1ff86ffceede46c7a67fec92c8319c3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-05-09T09:16:49+02:00
dialog: open db connection in POSTCHILDINIT callback for DB_MODE_SHUTDOWN
---
Modified: src/modules/dialog/dialog.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1ff86ffceede46c7a67fec92c8319c3…
Patch:
https://github.com/kamailio/kamailio/commit/1ff86ffceede46c7a67fec92c8319c3…
---
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 08f0a85882..4d30b2748f 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -738,6 +738,10 @@ static int mod_init(void)
return -1;
}
+ if(dlg_db_mode==DB_MODE_SHUTDOWN) {
+ ksr_module_set_flag(KSRMOD_FLAG_POSTCHILDINIT);
+ }
+
return 0;
}
@@ -777,9 +781,9 @@ static int child_init(int rank)
}
}
- if ( ((dlg_db_mode==DB_MODE_REALTIME || dlg_db_mode==DB_MODE_DELAYED) &&
- (rank>0 || rank==PROC_TIMER || rank==PROC_RPC)) ||
- (dlg_db_mode==DB_MODE_SHUTDOWN && (rank==PROC_MAIN)) ) {
+ if ( ((dlg_db_mode==DB_MODE_REALTIME || dlg_db_mode==DB_MODE_DELAYED)
+ && (rank>0 || rank==PROC_TIMER || rank==PROC_RPC))
+ || (dlg_db_mode==DB_MODE_SHUTDOWN && (rank==PROC_POSTCHILDINIT)) ) {
if ( dlg_connect_db(&db_url) ) {
LM_ERR("failed to connect to database (rank=%d)\n",rank);
return -1;