Prechádzať zdrojové kódy

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 rokov pred
rodič
commit
0fbac693b4
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  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 )
 	if(rtpp_set_list==NULL )
 		return 0;
 		return 0;
 
 
+	if(rank==PROC_INIT || (rank==PROC_MAIN && dont_fork==0)) {
+		return 0;
+	}
+
 	/* Iterate known RTP proxies - create sockets */
 	/* Iterate known RTP proxies - create sockets */
 	mypid = getpid();
 	mypid = getpid();
 
 
@@ -870,6 +874,7 @@ child_init(int rank)
 		LM_ERR("no more pkg memory\n");
 		LM_ERR("no more pkg memory\n");
 		return -1;
 		return -1;
 	}
 	}
+	memset(rtpp_socks, -1, sizeof(int)*rtpp_no);
 
 
 	for(rtpp_list = rtpp_set_list->rset_first; rtpp_list != 0;
 	for(rtpp_list = rtpp_set_list->rset_first; rtpp_list != 0;
 			rtpp_list = rtpp_list->rset_next){
 			rtpp_list = rtpp_list->rset_next){