[sr-dev] git:master:0fbac693: rtpproxy: init rtpproxy sockets array after allocation

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 7 14:54:47 CEST 2016


Module: kamailio
Branch: master
Commit: 0fbac693b4d3ed913b64c2d000f27a96903b7e09
URL: https://github.com/kamailio/kamailio/commit/0fbac693b4d3ed913b64c2d000f27a96903b7e09

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-07-07T14:53:28+02:00

rtpproxy: init rtpproxy sockets array after allocation

- do not init sockets for PROC_MAIN (for for=yes) and PROC_INIT to
  avoid duplicating sockets with child processed

---

Modified: modules/rtpproxy/rtpproxy.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0fbac693b4d3ed913b64c2d000f27a96903b7e09.diff
Patch: https://github.com/kamailio/kamailio/commit/0fbac693b4d3ed913b64c2d000f27a96903b7e09.patch

---

diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c
index aacfb23..a36d323 100644
--- a/modules/rtpproxy/rtpproxy.c
+++ b/modules/rtpproxy/rtpproxy.c
@@ -862,6 +862,10 @@ child_init(int rank)
 	if(rtpp_set_list==NULL )
 		return 0;
 
+	if(rank==PROC_INIT || (rank==PROC_MAIN && dont_fork==0)) {
+		return 0;
+	}
+
 	/* Iterate known RTP proxies - create sockets */
 	mypid = getpid();
 
@@ -870,6 +874,7 @@ child_init(int rank)
 		LM_ERR("no more pkg memory\n");
 		return -1;
 	}
+	memset(rtpp_socks, -1, sizeof(int)*rtpp_no);
 
 	for(rtpp_list = rtpp_set_list->rset_first; rtpp_list != 0;
 			rtpp_list = rtpp_list->rset_next){




More information about the sr-dev mailing list