Module: sip-router
Branch: master
Commit: 4047fc33053898d17498104b849dae9e45bee1e6
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4047fc3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Jul 1 12:04:52 2010 +0200
kmi: allow multiple initializations of mi child
- safety check to detect if mi child was initialized
- protect against multiple initializations that can occure due to
usage from MI or RPC processes
---
lib/kmi/mi.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/kmi/mi.c b/lib/kmi/mi.c
index dfa458e..8d2c01d 100644
--- a/lib/kmi/mi.c
+++ b/lib/kmi/mi.c
@@ -97,10 +97,14 @@ int register_mi_mod( char *mod_name, mi_export_t *mis)
}
+static int mi_commands_initialized = 0;
+
int init_mi_child(void)
{
int i;
+ if(mi_commands_initialized)
+ return 0;
for ( i=0 ; i<mi_cmds_no ; i++ ) {
if ( mi_cmds[i].init_f && mi_cmds[i].init_f()!=0 ) {
LM_ERR("failed to init <%.*s>\n",
@@ -108,6 +112,7 @@ int init_mi_child(void)
return -1;
}
}
+ mi_commands_initialized = 1;
return 0;
}