Module: sip-router Branch: master Commit: af18dae034cf8836f1627929f189983ca6010428 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=af18dae0...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Thu Jul 1 12:08:42 2010 +0200
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
---
modules/mi_rpc/mi_rpc_mod.c | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/modules/mi_rpc/mi_rpc_mod.c b/modules/mi_rpc/mi_rpc_mod.c index b678f25..14b58e3 100644 --- a/modules/mi_rpc/mi_rpc_mod.c +++ b/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) {