[sr-dev] git:master: xmpp(k): enable cfg framework for module's extra process

Daniel-Constantin Mierla miconda at gmail.com
Sun Apr 10 12:48:24 CEST 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Apr 10 12:18:44 2011 +0200

xmpp(k): enable cfg framework for module's extra process

---

 modules_k/xmpp/xmpp.c           |    8 +++++++-
 modules_k/xmpp/xmpp_component.c |    4 ++++
 modules_k/xmpp/xmpp_server.c    |    5 +++++
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/modules_k/xmpp/xmpp.c b/modules_k/xmpp/xmpp.c
index e7a0093..ad087e4 100644
--- a/modules_k/xmpp/xmpp.c
+++ b/modules_k/xmpp/xmpp.c
@@ -118,6 +118,7 @@
 #include "../../parser/parse_content.h"
 #include "../../parser/parse_from.h"
 #include "../../modules/tm/tm_load.h"
+#include "../../cfg/cfg_struct.h"
 
 #include "xode.h"
 #include "xmpp.h"
@@ -245,7 +246,8 @@ static int mod_init(void) {
 
 	/* add space for one extra process */
 	register_procs(1);
-
+	/* add child to update local config framework structures */
+	cfg_register_child(1);
 
 	return 0;
 }
@@ -263,6 +265,10 @@ static int child_init(int rank)
 			return -1; /* error */
 		if(pid==0){
 			/* child */
+			/* initialize the config framework */
+			if (cfg_child_init())
+				return -1;
+
 			xmpp_process(1);
 		}
 	}
diff --git a/modules_k/xmpp/xmpp_component.c b/modules_k/xmpp/xmpp_component.c
index e93b040..123f11a 100644
--- a/modules_k/xmpp/xmpp_component.c
+++ b/modules_k/xmpp/xmpp_component.c
@@ -49,6 +49,7 @@
 #include <string.h>
 
 #include "../../sr_module.h"
+#include "../../cfg/cfg_struct.h"
 
 #include "xmpp.h"
 #include "xmpp_api.h"
@@ -221,6 +222,9 @@ int xmpp_component_child_process(int data_pipe)
 			maxfd = fd > data_pipe ? fd : data_pipe;
 			rv = select(maxfd + 1, &fdset, NULL, NULL, NULL);
 			
+			/* update the local config framework structures */
+			cfg_update();
+
 			if (rv < 0) {
 				LM_ERR("select() failed: %s\n", strerror(errno));
 			} else if (!rv) {
diff --git a/modules_k/xmpp/xmpp_server.c b/modules_k/xmpp/xmpp_server.c
index 74b82a3..cc355b4 100644
--- a/modules_k/xmpp/xmpp_server.c
+++ b/modules_k/xmpp/xmpp_server.c
@@ -91,6 +91,7 @@
 #include <string.h>
 
 #include "../../sr_module.h"
+#include "../../cfg/cfg_struct.h"
 
 #include "xmpp.h"
 #include "xmpp_api.h"
@@ -497,6 +498,10 @@ int xmpp_server_child_process(int data_pipe)
 		}
 
 		rv = select(FD_SETSIZE, &fdset, NULL, NULL, NULL);
+
+		/* update the local config framework structures */
+		cfg_update();
+
 		if (rv < 0) {
 			LM_ERR("select() failed: %s\n", strerror(errno));
 		} else if (!rv) {




More information about the sr-dev mailing list