version 1.852, 2007/03/28 00:12:58
|
version 1.854, 2007/03/28 21:44:13
|
Line 53 use Digest::MD5;
|
Line 53 use Digest::MD5;
|
use Math::Random; |
use Math::Random; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
|
use Apache::lonhosts; |
|
|
my $readit; |
my $readit; |
my $max_connection_retries = 10; # Or some such value. |
my $max_connection_retries = 10; # Or some such value. |
Line 145 sub logperm {
|
Line 146 sub logperm {
|
} |
} |
|
|
sub create_connection { |
sub create_connection { |
my ($server) = @_; |
my ($hostname,$lonid) = @_; |
my $client=IO::Socket::UNIX->new(Peer => $perlvar{'lonSockCreate'}, |
my $client=IO::Socket::UNIX->new(Peer => $perlvar{'lonSockCreate'}, |
Type => SOCK_STREAM, |
Type => SOCK_STREAM, |
Timeout => 10); |
Timeout => 10); |
return 0 if (!$client); |
return 0 if (!$client); |
print $client ("$server\n"); |
print $client (join(':',$hostname,$lonid,&machine_ids($lonid))."\n"); |
my $result = <$client>; |
my $result = <$client>; |
chomp($result); |
chomp($result); |
return 1 if ($result eq 'done'); |
return 1 if ($result eq 'done'); |
Line 185 sub subreply {
|
Line 186 sub subreply {
|
if($client) { |
if($client) { |
last; # Connected! |
last; # Connected! |
} else { |
} else { |
&create_connection(&hostname($server)); |
&create_connection(&hostname($server),$server); |
} |
} |
sleep(1); # Try again later if failed connection. |
sleep(1); # Try again later if failed connection. |
} |
} |
Line 7426 sub hreflocation {
|
Line 7427 sub hreflocation {
|
} |
} |
|
|
sub current_machine_domains { |
sub current_machine_domains { |
my $hostname=&hostname($perlvar{'lonHostID'}); |
return &machine_domains(&hostname($perlvar{'lonHostID'})); |
|
} |
|
|
|
sub machine_domains { |
|
my ($hostname) = @_; |
my @domains; |
my @domains; |
my %hostname = &all_hostnames(); |
my %hostname = &all_hostnames(); |
while( my($id, $name) = each(%hostname)) { |
while( my($id, $name) = each(%hostname)) { |
Line 7439 sub current_machine_domains {
|
Line 7444 sub current_machine_domains {
|
} |
} |
|
|
sub current_machine_ids { |
sub current_machine_ids { |
my $hostname=&hostname($perlvar{'lonHostID'}); |
return &machine_ids(&hostname($perlvar{'lonHostID'})); |
|
} |
|
|
|
sub machine_ids { |
|
my ($hostname) = @_; |
|
$hostname ||= &hostname($perlvar{'lonHostID'}); |
my @ids; |
my @ids; |
my %hostname = &all_hostnames(); |
my %hostname = &all_hostnames(); |
while( my($id, $name) = each(%hostname)) { |
while( my($id, $name) = each(%hostname)) { |