[sr-dev] git:master:5d8d5653: janssonrpc-c: init cfg framework for additional process

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 13 16:04:42 CEST 2016


Module: kamailio
Branch: master
Commit: 5d8d565331111b80d72a20d19f2bcb14ea6301a4
URL: https://github.com/kamailio/kamailio/commit/5d8d565331111b80d72a20d19f2bcb14ea6301a4

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-07-13T16:03:32+02:00

janssonrpc-c: init cfg framework for additional process

- revealed by GH #708

---

Modified: modules/janssonrpc-c/janssonrpc_io.c
Modified: modules/janssonrpc-c/janssonrpc_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/5d8d565331111b80d72a20d19f2bcb14ea6301a4.diff
Patch: https://github.com/kamailio/kamailio/commit/5d8d565331111b80d72a20d19f2bcb14ea6301a4.patch

---

diff --git a/modules/janssonrpc-c/janssonrpc_io.c b/modules/janssonrpc-c/janssonrpc_io.c
index 1e1a82b..ed0be6c 100644
--- a/modules/janssonrpc-c/janssonrpc_io.c
+++ b/modules/janssonrpc-c/janssonrpc_io.c
@@ -39,6 +39,7 @@
 #include "../../action.h"
 #include "../../route_struct.h"
 #include "../../lvalue.h"
+#include "../../cfg/cfg_struct.h"
 #include "../../rand/fastrand.h"
 #include "../tm/tm_load.h"
 #include "../jansson/jansson_utils.h"
@@ -57,11 +58,15 @@ void io_shutdown(int sig);
 
 int jsonrpc_io_child_process(int cmd_pipe)
 {
+	struct event* pipe_ev = NULL;
+
 	global_ev_base = event_base_new();
 	global_evdns_base = evdns_base_new(global_ev_base, 1);
 
 	set_non_blocking(cmd_pipe);
-	struct event* pipe_ev = event_new(global_ev_base, cmd_pipe, EV_READ | EV_PERSIST, cmd_pipe_cb, NULL);
+	pipe_ev = event_new(global_ev_base, cmd_pipe,
+			EV_READ | EV_PERSIST, cmd_pipe_cb, NULL);
+
 	if(!pipe_ev) {
 		ERR("Failed to create pipe event\n");
 		return -1;
@@ -449,6 +454,7 @@ void cmd_pipe_cb(int fd, short event, void *arg)
 		return;
 	}
 
+	cfg_update();
 
 	switch(cmd->type) {
 	case CMD_CLOSE:
diff --git a/modules/janssonrpc-c/janssonrpc_mod.c b/modules/janssonrpc-c/janssonrpc_mod.c
index 7db22cc..c69b843 100644
--- a/modules/janssonrpc-c/janssonrpc_mod.c
+++ b/modules/janssonrpc-c/janssonrpc_mod.c
@@ -29,6 +29,7 @@
 #include "../../trim.h"
 #include "../../sr_module.h"
 #include "../../timer_proc.h"
+#include "../../cfg/cfg_struct.h"
 #include "../tm/tm_load.h"
 #include "../jansson/jansson_utils.h"
 
@@ -194,6 +195,7 @@ static int child_init(int rank)
 		return -1; /* error */
 	if(pid==0){
 		/* child */
+		if (cfg_child_init()) return -1;
 		close(pipe_fds[1]);
 		return jsonrpc_io_child_process(pipe_fds[0]);
 	}




More information about the sr-dev mailing list