From ce94e8497bac5990dd17957b2ffed860518ba85a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 11 Aug 2008 18:13:35 +0000 Subject: [PATCH] -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 --- xCAT-server/sbin/xcatd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index b43ebb67a..776c8b6b2 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -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);