2
0
Эх сурвалжийг харах

drouting: check if db connection is initialized

- applied for the case of mi reload command
(cherry picked from commit 76266ca085d05be949ddc34df513de6810c5d65f)
Daniel-Constantin Mierla 15 жил өмнө
parent
commit
8a9b915901

+ 9 - 0
modules_k/drouting/drouting.c

@@ -474,6 +474,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;