version 1.2, 1999/10/26 20:24:47
|
version 1.3, 1999/11/18 19:52:46
|
Line 11
|
Line 11
|
# USR1 tries to open connections again |
# USR1 tries to open connections again |
|
|
# 6/4/99,6/5,6/7,6/8,6/9,6/10,6/11,6/12,7/14,7/19, |
# 6/4/99,6/5,6/7,6/8,6/9,6/10,6/11,6/12,7/14,7/19, |
# 10/8,10/9,10/15 Gerd Kortemeyer |
# 10/8,10/9,10/15,11/18 Gerd Kortemeyer |
# based on nonforker from Perl Cookbook |
# based on nonforker from Perl Cookbook |
# - server who multiplexes without forking |
# - server who multiplexes without forking |
|
|
Line 122 sub logthis {
|
Line 122 sub logthis {
|
print $fh "$local ($$): $message\n"; |
print $fh "$local ($$): $message\n"; |
} |
} |
|
|
|
|
|
sub logperm { |
|
my $message=shift; |
|
my $execdir=$perlvar{'lonDaemons'}; |
|
my $now=time; |
|
my $local=localtime($now); |
|
my $fh=IO::File->new(">>$execdir/logs/lonnet.perm.log"); |
|
print $fh "$now:$message:$local\n"; |
|
} |
|
|
# ---------------------------------------------------- Fork once and dissociate |
# ---------------------------------------------------- Fork once and dissociate |
|
|
$fpid=fork; |
$fpid=fork; |
Line 243 if ($cipher=new IDEA $cipherkey) {
|
Line 253 if ($cipher=new IDEA $cipherkey) {
|
&logthis("Error: Could not establish secure connection, $conserver!"); |
&logthis("Error: Could not establish secure connection, $conserver!"); |
} |
} |
|
|
|
# ----------------------------------------- We're online, send delayed messages |
|
|
|
my $path="$perlvar{'lonSockDir'}/delayed"; |
|
my $dfname; |
|
while ($dfname=<$path/*.$conserver>) { |
|
my $wcmd; |
|
{ |
|
my $dfh=IO::File->new($dfname); |
|
$wcmd=<$dfh>; |
|
} |
|
my ($server,$cmd)=split(/:/,$wcmd); |
|
chomp($cmd); |
|
my $bcmd=$cmd; |
|
if ($cmd =~ /^encrypt\:/) { |
|
my $rcmd=$cmd; |
|
$rcmd =~ s/^encrypt\://; |
|
chomp($rcmd); |
|
my $cmdlength=length($rcmd); |
|
$rcmd.=" "; |
|
my $encrequest=''; |
|
for (my $encidx=0;$encidx<=$cmdlength;$encidx+=8) { |
|
$encrequest.= |
|
unpack("H16",$cipher->encrypt(substr($rcmd,$encidx,8))); |
|
} |
|
$cmd="enc:$cmdlength:$encrequest\n"; |
|
} |
|
|
|
print $remotesock "$cmd\n"; |
|
$answer=<$remotesock>; |
|
chomp($answer); |
|
if ($answer ne '') { |
|
unlink("$dfname"); |
|
&logthis("Delayed $cmd to $conserver ($server): >$answer<"); |
|
&logperm("S:$conserver:$bcmd"); |
|
} |
|
} |
|
|
# ------------------------------------------------------- Listen to UNIX socket |
# ------------------------------------------------------- Listen to UNIX socket |
unless ( |
unless ( |