From e7b482184451ade9f1ecfff6f80049d9c3a7e8bf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 May 2012 07:13:26 -0500 Subject: [PATCH] clean up forking code in example --- src/mod/xml_int/mod_xml_scgi/xml_scgi_server.pl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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; } + + +