]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
clean up forking code in example
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 14 May 2012 12:13:26 +0000 (07:13 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 14 May 2012 12:13:26 +0000 (07:13 -0500)
src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl

index 2c7575f64c68c6aa862d45832227fd6281a3e2c5..0f4af275bc999ac7377bf1c51d5a65d6ac70827f 100644 (file)
@@ -61,11 +61,17 @@ my $xml = qq#
 </document>
 #;
 
+$SIG{CHLD} = "IGNORE";
 
 while (my $request = $scgi->accept) {
-
   # fork every new req into its own process (optional)
-  next unless(my $pid = fork());
+  my $pid = fork();
+
+  if ($pid) {
+    $request->close();
+    next;
+  }
+
   my $handle = $request->connection;
 
   $request->read_env;
@@ -89,5 +95,9 @@ while (my $request = $scgi->accept) {
   #print $handle "Content-Type: text/xml\n\n";
 
   print $handle $xml;
-  exit if (!$pid);
+
+  exit unless $pid;
 }
+
+
+