[sr-dev] git:master:70fa5b79: jsonrpcs: init dgram sockets via mod init callback

Daniel-Constantin Mierla miconda at gmail.com
Sat Oct 21 23:48:35 CEST 2017


Module: kamailio
Branch: master
Commit: 70fa5b79e413e162427f5a8ffad3357252c517e2
URL: https://github.com/kamailio/kamailio/commit/70fa5b79e413e162427f5a8ffad3357252c517e2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-10-21T12:10:29+02:00

jsonrpcs: init dgram sockets via mod init callback

---

Modified: src/modules/jsonrpcs/jsonrpcs_sock.c

---

Diff:  https://github.com/kamailio/kamailio/commit/70fa5b79e413e162427f5a8ffad3357252c517e2.diff
Patch: https://github.com/kamailio/kamailio/commit/70fa5b79e413e162427f5a8ffad3357252c517e2.patch

---

diff --git a/src/modules/jsonrpcs/jsonrpcs_sock.c b/src/modules/jsonrpcs/jsonrpcs_sock.c
index 94a068b3f5..b17feb2b86 100644
--- a/src/modules/jsonrpcs/jsonrpcs_sock.c
+++ b/src/modules/jsonrpcs/jsonrpcs_sock.c
@@ -90,7 +90,7 @@ int jsonrpc_dgram_destroy(void);
 
 
 void jsonrpc_dgram_server(int rx_sock, int tx_sock);
-static int jsonrpc_dgram_pre_process(void);
+static int jsonrpc_dgram_init_socks(void);
 static int jsonrpc_dgram_post_process(void);
 
 int jsonrpc_dgram_mod_init(void)
@@ -241,6 +241,11 @@ int jsonrpc_dgram_mod_init(void)
 			jsonrpc_dgram_socket, strlen(jsonrpc_dgram_socket));
 
 done:
+	if(jsonrpc_dgram_init_socks()!=0) {
+		LM_ERR("init datagram sockets function failed\n");
+		return -1;
+	}
+
 	/* add space for extra processes */
 	register_procs(jsonrpc_dgram_workers);
 	/* add child to update local config framework structures */
@@ -395,7 +400,7 @@ int jsonrpc_dgram_init_server(jsonrpc_dgram_sockaddr_t *addr,
 }
 
 
-static int jsonrpc_dgram_pre_process(void)
+static int jsonrpc_dgram_init_socks(void)
 {
 	int res;
 
@@ -448,10 +453,6 @@ int jsonrpc_dgram_child_init(int rank)
 	int pid;
 
 	if (rank==PROC_MAIN) {
-		if(jsonrpc_dgram_pre_process()!=0) {
-			LM_ERR("pre-fork function failed\n");
-			return -1;
-		}
 		for(i=0; i<jsonrpc_dgram_workers; i++) {
 			pid=fork_process(PROC_RPC, "JSONRPCS DATAGRAM", 1);
 			if (pid<0)




More information about the sr-dev mailing list