-Change xCATd to not fork when not having to dispatch commands to peer servers

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2009 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-08-11 18:13:35 +00:00
parent 3e0bb866b2
commit ce94e8497b

View File

@ -859,11 +859,22 @@ sub dispatch_request {
$dispatch_children=0;
$SIG{CHLD} = \&dispatch_reaper; #sub {my $cpid; while (($cpid =waitpid(-1, WNOHANG)) > 0) { if ($dispatched_children{$cpid}) { delete $dispatched_children{$cpid}; $dispatch_children--; } } };
my $onlyone=0;
if (scalar(@{$reqs}) == 1) {
$onlyone=1;
}
foreach (@{$reqs}) {
my $pfd;
my $parfd; #use a private variable so it won't trounce itself recursively
my $child;
delete $_->{noderange};
if ($onlyone and not ($_->{'_xcatdest'} and thishostisnot($_->{'_xcatdest'}))) {
undef $SIG{CHLD};
${"xCAT_plugin::".$modname."::"}{process_request}->($_,$dispatch_cb,\&do_request);
return;
}
socketpair($pfd, $parfd,AF_UNIX,SOCK_STREAM,PF_UNSPEC) or die "socketpair: $!";
$parfd->autoflush(1);
$pfd->autoflush(1);