Explorar o código

jsonrpcc: init and update cfg framework for io handler process

- GH #1520
Daniel-Constantin Mierla %!s(int64=7) %!d(string=hai) anos
pai
achega
bb14964dd8
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  1. 4 0
      src/modules/jsonrpcc/jsonrpc_io.c
  2. 5 0
      src/modules/jsonrpcc/jsonrpcc_mod.c

+ 4 - 0
src/modules/jsonrpcc/jsonrpc_io.c

@@ -33,6 +33,8 @@
 #include "../../core/route.h"
 #include "../../core/route_struct.h"
 #include "../../core/lvalue.h"
+#include "../../core/cfg/cfg_struct.h"
+
 #include "../tm/tm_load.h"
 
 #include "jsonrpc_io.h"
@@ -156,6 +158,8 @@ void cmd_pipe_cb(int fd, short event, void *arg)
 		return;
 	}
 
+	cfg_update();
+
 	params = json_tokener_parse(cmd->params);
 
 	if (cmd->notify_only) {

+ 5 - 0
src/modules/jsonrpcc/jsonrpcc_mod.c

@@ -28,6 +28,8 @@
 #include "../../core/mod_fix.h"
 #include "../../core/trim.h"
 #include "../../core/sr_module.h"
+#include "../../core/cfg/cfg_struct.h"
+
 #include "../tm/tm_load.h"
 
 #include "jsonrpc_request.h"
@@ -139,6 +141,9 @@ static int child_init(int rank)
 	if(pid==0){
 		/* child */
 		close(pipe_fds[1]);
+		/* initialize the config framework */
+		if (cfg_child_init())
+			return -1;
 		return jsonrpc_io_child_process(pipe_fds[0], servers_param);
 	}
 	return 0;