Browse Source

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
Daniel-Constantin Mierla 9 years ago
parent
commit
0fbac693b4
1 changed files with 5 additions and 0 deletions
  1. 5 0
      modules/rtpproxy/rtpproxy.c

+ 5 - 0
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){