فهرست منبع

bug fix: open_fifo_server now calls its init_child to make
sure that modules' child initialization was done from fifo
process prior to executing fifo commands

Jiri Kuthan 23 سال پیش
والد
کامیت
1380e79e22
2فایلهای تغییر یافته به همراه16 افزوده شده و 8 حذف شده
  1. 10 3
      fifo_server.c
  2. 6 5
      main.c

+ 10 - 3
fifo_server.c

@@ -300,8 +300,8 @@ static void fifo_server(FILE *fifo_stream)
 			goto consume;
 		}
 		if (*buf!=CMD_SEPARATOR) {
-			LOG(L_ERR, "ERROR: fifo_server: command must start with %c\n", 
-				CMD_SEPARATOR);
+			LOG(L_ERR, "ERROR: fifo_server: command must begin with %c: %.*s\n", 
+				CMD_SEPARATOR, line_len, buf );
 			goto consume;
 		}
 		command=buf+1;
@@ -389,9 +389,16 @@ int open_fifo_server()
 	}
 	if (fifo_pid==0) { /* child == FIFO server */
 		LOG(L_INFO, "INFO: fifo process starting: %d\n", getpid());
+		/* call per-child module initialization too -- some
+		   FIFO commands may need it
+		*/
+		if (init_child(0) < 0 ) {
+			LOG(L_ERR, "ERROR: open_uac_fifo: init_child failed\n");
+			return -1;
+		}
 		fifo_read=open(fifo, O_RDONLY, 0);
 		if (fifo_read<0) {
-			LOG(L_ERR, "SER: open_uac_fifo: fifo_read did not open: %s\n",
+			LOG(L_ERR, "ERROR: open_uac_fifo: fifo_read did not open: %s\n",
 				strerror(errno));
 			return -1;
 		}

+ 6 - 5
main.c

@@ -498,6 +498,12 @@ int main_loop()
 		pids[0]=getpid();
 		process_bit = 1;
 		process_no=0; /*main process number*/
+
+		/* if configured to do so, start a server for accepting FIFO commands */
+		if (open_fifo_server()<0) {
+			LOG(L_ERR, "opening fifo server failed\n");
+			goto error;
+		}
 		
 		     /* We will call child_init even if we
 		      * do not fork
@@ -508,11 +514,6 @@ int main_loop()
 			goto error;
 		}
 
-		/* if configured to do so, start a server for accepting FIFO commands */
-		if (open_fifo_server()<0) {
-			LOG(L_ERR, "opening fifo server failed\n");
-			goto error;
-		}
 		is_main=1; /* hack 42: call init_child with is_main=0 in case
 					 some modules wants to fork a child */