[SR-Dev] git:master: mi_xmlrpc: start xmlrpc listeners using SR interface

Daniel-Constantin Mierla miconda at gmail.com
Sat Apr 18 18:35:27 CEST 2009


Module: sip-router
Branch: master
Commit: a752507c7806c0297aa48b3a8a53825c6ff5b871
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a752507c7806c0297aa48b3a8a53825c6ff5b871

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sat Apr 18 18:34:48 2009 +0200

mi_xmlrpc: start xmlrpc listeners using SR interface

- xmlrpc process started from PROC_MAIN

---

 modules_k/mi_xmlrpc/mi_xmlrpc.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/modules_k/mi_xmlrpc/mi_xmlrpc.c b/modules_k/mi_xmlrpc/mi_xmlrpc.c
index 9e5e504..2b0e59d 100644
--- a/modules_k/mi_xmlrpc/mi_xmlrpc.c
+++ b/modules_k/mi_xmlrpc/mi_xmlrpc.c
@@ -62,6 +62,7 @@
 
 #include "../../sr_module.h"
 #include "../../str.h"
+#include "../../pt.h"
 #include "../../mem/mem.h"
 #include "../../mem/shm_mem.h"
 
@@ -74,6 +75,7 @@ int rpl_opt = 0;
 /* module functions */
 static int mod_init();
 static void destroy(void);
+static int child_init(int rank);
 static void xmlrpc_process(int rank);
 
 static int port = 8080;
@@ -111,7 +113,7 @@ struct module_exports exports = {
 	mod_init,                           /* module initialization function */
 	0,                                  /* response handling function */
 	destroy,                            /* destroy function */
-	0                                   /* per-child init function */
+	child_init                          /* per-child init function */
 };
 
 
@@ -129,9 +131,26 @@ static int mod_init(void)
 		return -1;
 	}
 
+	/* add space for extra processes */
+	register_procs(1);
+
 	return 0;
 }
 
+static int child_init(int rank)
+{
+	int pid;
+	if (rank==PROC_MAIN) {
+		pid=fork_process(100, "MI XMLRPC", 1);
+		if (pid<0)
+			return -1; /* error */
+		if(pid==0){
+			/* child */
+			xmlrpc_process(1);
+		}
+	}
+	return 0;
+}
 
 static void xmlrpc_sigchld( int sig )
 {




More information about the sr-dev mailing list