Module: kamailio
Branch: 4.4
Commit: 12777af81509e3f6aa3e88c6aacb8844403d1e0b
URL:
https://github.com/kamailio/kamailio/commit/12777af81509e3f6aa3e88c6aacb884…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2016-07-13T17:31:52+02:00
janssonrpc-c: init cfg framework for additional process
- revealed by GH #708
(cherry picked from commit 5d8d565331111b80d72a20d19f2bcb14ea6301a4)
---
Modified: modules/janssonrpc-c/janssonrpc_io.c
Modified: modules/janssonrpc-c/janssonrpc_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/12777af81509e3f6aa3e88c6aacb884…
Patch:
https://github.com/kamailio/kamailio/commit/12777af81509e3f6aa3e88c6aacb884…
---
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]);
}