瀏覽代碼

mi_rpc: call MI init child functions

- MI init child functions called for RPC processes
- fix for several MI commands that can be executed now via RPC and they
  needed to do specific initialization for each process
- reported by Juha Heinanen
(cherry picked from commit af18dae034cf8836f1627929f189983ca6010428)
Daniel-Constantin Mierla 15 年之前
父節點
當前提交
6028bb26af
共有 1 個文件被更改,包括 21 次插入8 次删除
  1. 21 8
      modules/mi_rpc/mi_rpc_mod.c

+ 21 - 8
modules/mi_rpc/mi_rpc_mod.c

@@ -30,6 +30,8 @@
 
 MODULE_VERSION
 
+static int child_init(int rank);
+
 static str mi_rpc_indent = { "\t", 1 };
 
 static const char* rpc_mi_exec_doc[2] = {
@@ -63,17 +65,28 @@ rpc_export_t mr_rpc[] = {
 
 struct module_exports exports = {
 	"mi_rpc",
-	0,        /* Exported functions */
-	mr_rpc,   /* RPC methods */
-	0,        /* Export parameters */
-	0,        /* Module initialization function */
-	0,        /* Response function */
-	0,        /* Destroy function */
-	0,        /* OnCancel function */
-	0         /* Child initialization function */
+	0,           /* Exported functions */
+	mr_rpc,      /* RPC methods */
+	0,           /* Export parameters */
+	0,           /* Module initialization function */
+	0,           /* Response function */
+	0,           /* Destroy function */
+	0,           /* OnCancel function */
+	child_init   /* Child initialization function */
 };
 
 
+static int child_init(int rank)
+{
+	if(rank==PROC_RPC) {
+		if( init_mi_child()!=0) {
+			LM_CRIT("Failed to init the mi commands\n");
+			return -1;
+		}
+	}
+
+	return 0;
+}
 
 struct mi_root *mi_rpc_read_params(rpc_t *rpc, void *ctx)
 {