version 1.83, 2007/04/11 00:10:45
|
version 1.87, 2007/06/18 22:49:52
|
Line 158 sub LogPerm {
|
Line 158 sub LogPerm {
|
my $now=time; |
my $now=time; |
my $local=localtime($now); |
my $local=localtime($now); |
my $fh=IO::File->new(">>$execdir/logs/lonnet.perm.log"); |
my $fh=IO::File->new(">>$execdir/logs/lonnet.perm.log"); |
|
chomp($message); |
print $fh "$now:$message:$local\n"; |
print $fh "$now:$message:$local\n"; |
} |
} |
|
|
Line 502 the data and Event->w->fd is the socket
|
Line 503 the data and Event->w->fd is the socket
|
sub ClientWritable { |
sub ClientWritable { |
my $Event = shift; |
my $Event = shift; |
my $Watcher = $Event->w; |
my $Watcher = $Event->w; |
|
if (!defined($Watcher)) { |
|
&child_exit(-1,'No watcher for event in ClientWritable'); |
|
} |
my $Data = $Watcher->data; |
my $Data = $Watcher->data; |
my $Socket = $Watcher->fd; |
my $Socket = $Watcher->fd; |
|
|
Line 565 sub ClientWritable {
|
Line 569 sub ClientWritable {
|
} |
} |
} else { |
} else { |
$Watcher->cancel(); # A delayed request...just cancel. |
$Watcher->cancel(); # A delayed request...just cancel. |
|
return; |
} |
} |
} |
} |
|
|
Line 604 sub CompleteTransaction {
|
Line 609 sub CompleteTransaction {
|
StartClientReply($Transaction, $data); |
StartClientReply($Transaction, $data); |
} else { # Delete deferred transaction file. |
} else { # Delete deferred transaction file. |
Log("SUCCESS", "A delayed transaction was completed"); |
Log("SUCCESS", "A delayed transaction was completed"); |
LogPerm("S:$Transaction->getClient() :".$Transaction->getRequest()); |
LogPerm("S:".$Transaction->getClient().":".$Transaction->getRequest()); |
unlink $Transaction->getFile(); |
unlink($Transaction->getFile()); |
} |
} |
} |
} |
|
|
Line 1378 sub ClientRequest {
|
Line 1383 sub ClientRequest {
|
$data = $data.$thisread; # Append new data. |
$data = $data.$thisread; # Append new data. |
$watcher->data($data); |
$watcher->data($data); |
if($data =~ /\n$/) { # Request entirely read. |
if($data =~ /\n$/) { # Request entirely read. |
if($data eq "close_connection_exit\n") { |
if ($data eq "close_connection_exit\n") { |
Log("CRITICAL", |
Log("CRITICAL", |
"Request Close Connection ... exiting"); |
"Request Close Connection ... exiting"); |
CloseAllLondConnections(); |
CloseAllLondConnections(); |
exit; |
exit; |
|
} elsif ($data eq "reset_retries\n") { |
|
Log("INFO", "Resetting Connection Retries."); |
|
$ConnectionRetriesLeft = $ConnectionRetries; |
|
&UpdateStatus(); |
|
my $Transaction = LondTransaction->new($data); |
|
$Transaction->SetClient($socket); |
|
StartClientReply($Transaction, "ok\n"); |
|
$watcher->cancel(); |
|
return; |
} |
} |
Debug(8, "Complete transaction received: ".$data); |
Debug(8, "Complete transaction received: ".$data); |
if($LogTransactions) { |
if ($LogTransactions) { |
Log("SUCCESS", "Transaction: '$data'"); # Transaction has \n. |
Log("SUCCESS", "Transaction: '$data'"); # Transaction has \n. |
} |
} |
my $Transaction = LondTransaction->new($data); |
my $Transaction = LondTransaction->new($data); |
Line 1893 sub parent_listen {
|
Line 1907 sub parent_listen {
|
|
|
sub parent_clean_up { |
sub parent_clean_up { |
my ($loncapa_host) = @_; |
my ($loncapa_host) = @_; |
Debug(-1, "parent_clean_up: $loncapa_host"); |
Debug(1, "parent_clean_up: $loncapa_host"); |
|
|
my $socket_file = &GetLoncSocketPath($loncapa_host); |
my $socket_file = &GetLoncSocketPath($loncapa_host); |
unlink($socket_file); # No problem if it doesn't exist yet [startup e.g.] |
unlink($socket_file); # No problem if it doesn't exist yet [startup e.g.] |
Line 2145 SIGHUP. Responds to sigint and sigterm.
|
Line 2159 SIGHUP. Responds to sigint and sigterm.
|
|
|
sub KillThemAll { |
sub KillThemAll { |
Debug(2, "Kill them all!!"); |
Debug(2, "Kill them all!!"); |
local($SIG{CHLD}) = 'IGNORE'; # Our children >will< die. |
|
foreach my $pid (keys %ChildPid) { |
#local($SIG{CHLD}) = 'IGNORE'; |
|
# Our children >will< die. |
|
# but we need to catch their death and cleanup after them in case this is |
|
# a restart set of kills |
|
my @allpids = keys(%ChildPid); |
|
foreach my $pid (@allpids) { |
my $serving = $ChildPid{$pid}; |
my $serving = $ChildPid{$pid}; |
ShowStatus("Nicely Killing lonc for $serving pid = $pid"); |
ShowStatus("Nicely Killing lonc for $serving pid = $pid"); |
Log("CRITICAL", "Nicely Killing lonc for $serving pid = $pid"); |
Log("CRITICAL", "Nicely Killing lonc for $serving pid = $pid"); |
kill 'QUIT' => $pid; |
kill 'QUIT' => $pid; |
} |
} |
|
ShowStatus("Finished killing child processes off."); |
} |
} |
|
|
|
|