[interchange-cvs] interchange - markj modified lib/Vend/Server.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Nov 7 06:51:21 EST 2007
User: markj
Date: 2007-11-07 11:51:20 GMT
Modified: lib/Vend Server.pm
Log:
* Making explicit the various implicit dependencies between PreFork,
PreForkSingleFork, and StartServers.
+ PreForkSingleFork should only ever affect behavior in conjunction with
PreFork true, ensuring the prefork code path is entirely controllable by
the value of PreFork.
+ Fixed condition on StartServers where a positive value for that parameter
when not in PreFork mode spawned a StartServers number of superfluous
daemons that were never used. Now, StartServers is effectively ignored
unless PreFork is also true.
Conditions were discovered by Brian Miller and Jon Jensen while combining
atypical combinations of the settings involved.
Revision Changes Path
2.84 +14 -10 interchange/lib/Vend/Server.pm
rev 2.84, prev_rev 2.83
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.83
retrieving revision 2.84
diff -u -r2.83 -r2.84
--- Server.pm 8 Oct 2007 16:55:22 -0000 2.83
+++ Server.pm 7 Nov 2007 11:51:19 -0000 2.84
@@ -1,6 +1,6 @@
# Vend::Server - Listen for Interchange CGI requests as a background server
#
-# $Id: Server.pm,v 2.83 2007/10/08 16:55:22 jon Exp $
+# $Id: Server.pm,v 2.84 2007/11/07 11:51:19 markj Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,7 +26,7 @@
package Vend::Server;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.83 $, 10);
+$VERSION = substr(q$Revision: 2.84 $, 10);
use Cwd;
use POSIX qw(setsid strftime);
@@ -1704,9 +1704,11 @@
);
}
my $dbl_fork_pid;
+ my $in_single_fork =
+ $no_fork && $Global::PreForkSingleFork;
if (
- $Global::PreForkSingleFork
+ $in_single_fork
or ! ($dbl_fork_pid = fork)
)
{
@@ -1722,7 +1724,7 @@
$Global::Foreground = 1 if $no_fork;
local $SIG{CHLD} = 'DEFAULT'
- if $Global::PreForkSingleFork;
+ if $in_single_fork;
local $SIG{INT} = $Routine_INT;
local $SIG{TERM} = $Routine_TERM;
@@ -1760,9 +1762,9 @@
exit(0);
}
starting_pids('add',$pid)
- if $Global::PreForkSingleFork;
+ if $in_single_fork;
}
- $Global::PreForkSingleFork or exit(0);
+ $in_single_fork or exit(0);
}
if ($dbl_fork_pid) {
@@ -1840,21 +1842,23 @@
my ($action,$pid,$n) = @_;
$n ||= 1;
+ my $in_single_fork =
+ $Global::PreFork && $Global::PreForkSingleFork;
if ( $action eq 'count' ) {
- return $Global::PreForkSingleFork
+ return $in_single_fork
? scalar keys %Starting_pids
: $Starting_pids
;
}
elsif ( $action eq 'add' ) {
- $Global::PreForkSingleFork
+ $in_single_fork
? ($Starting_pids{$pid} = time)
: ($Starting_pids += $n)
;
}
elsif ( $action eq 'del' ) {
- $Global::PreForkSingleFork
+ $in_single_fork
? delete ($Starting_pids{$pid})
: ($Starting_pids -= $n)
;
@@ -2451,7 +2455,7 @@
}
my $master_ipc = 0;
- if($Global::StartServers) {
+ if($Global::PreFork && $Global::StartServers) {
$master_ipc = 1;
$p_vector = $vector ^ $ipc_vector;
start_page(1, $Global::PreFork, $Global::StartServers);
More information about the interchange-cvs
mailing list