-Check in a throttling solution, but leave completely in comments, search for #THROTTLE for relevant code

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1332 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-05-08 15:22:22 +00:00
parent a86c8ea03e
commit 8d07642cf4

View File

@ -12,6 +12,8 @@ use Time::HiRes qw(sleep);
use Thread qw(yield);
use xCAT::Client submit_request;
my $clientselect = new IO::Select;
#my $sslclients = 0; #THROTTLE
#my $maxsslclients = 16; #default
sub xexit {
while (wait() > 0) {
@ -394,6 +396,13 @@ sub generic_reaper {
$SIG{CHLD} = \&generic_reaper;
}
#sub ssl_reaper {
# while (waitpid(-1,WNOHANG) > 0) {
# $sslclients--;
# }
# $SIG{CHLD} = \&ssl_reaper;
#}
sub dispatch_reaper {
while (($CHILDPID =waitpid(-1, WNOHANG)) > 0) {
if ($dispatched_children{$CHILDPID}) {
@ -463,9 +472,13 @@ xCAT_monitoring::monitorctrl::start($$);
my $peername;
my $ssltimeout;
#$SIG{CHLD} = \&ssl_reaper; #THROTTLE
until ($quit) {
next unless my $cnnection=$listener->accept;
my $connection;
#while ($sslclients > $maxsslclients) { #THROTTLE
# yield;
#}
my $child = xCAT::Utils->xfork(); #Yes we fork, IO::Socket::SSL is not threadsafe..
unless (defined $child) {
@ -473,6 +486,7 @@ until ($quit) {
}
if ($child == 0) {
#$SIG{CHLD} = \&generic_reaper; #THROTTLE
$listener->close;
$SIG{ALRM} = sub { $ssltimeout = 1; die; };
@ -528,6 +542,7 @@ if ($inet6support) {
service_connection($connection,$peername,$peerhost);
xexit(0);
}
#$sslclients++; #THROTTLE
$cnnection->close();
}
$listener->close;