From: Anthony Minessale Date: Mon, 14 May 2012 12:13:26 +0000 (-0500) Subject: clean up forking code in example X-Git-Tag: v1.2.0~398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7b482184451ade9f1ecfff6f80049d9c3a7e8bf;p=thirdparty%2Ffreeswitch.git clean up forking code in example --- diff --git a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl index 2c7575f64c..0f4af275bc 100644 --- a/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl +++ b/src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl @@ -61,11 +61,17 @@ my $xml = qq# #; +$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; } + + +