version 1.361, 2007/03/01 17:51:44
|
version 1.363, 2007/03/28 00:05:38
|
Line 1268 sub du_handler {
|
Line 1268 sub du_handler {
|
my $code=sub { |
my $code=sub { |
if ($_=~/\.\d+\./) { return;} |
if ($_=~/\.\d+\./) { return;} |
if ($_=~/\.meta$/) { return;} |
if ($_=~/\.meta$/) { return;} |
|
if (-d $_) { return;} |
$total_size+=(stat($_))[7]; |
$total_size+=(stat($_))[7]; |
}; |
}; |
chdir($ududir); |
chdir($ududir); |
Line 5308 sub reconlonc {
|
Line 5309 sub reconlonc {
|
} |
} |
} |
} |
|
|
# -------------------------------------------------- Non-critical communication |
sub create_connection { |
|
my ($server) = @_; |
|
my $client=IO::Socket::UNIX->new(Peer => $perlvar{'lonSockCreate'}, |
|
Type => SOCK_STREAM, |
|
Timeout => 10); |
|
return 0 if (!$client); |
|
print $client ("$server\n"); |
|
my $result = <$client>; |
|
chomp($result); |
|
return 1 if ($result eq 'done'); |
|
return 0; |
|
} |
|
|
|
# -------------------------------------------------- Non-critical communication |
|
my $max_connection_retries = 10; |
sub subreply { |
sub subreply { |
my ($cmd,$server)=@_; |
my ($cmd,$server)=@_; |
my $peerfile="$perlvar{'lonSockDir'}/".$hostname{$server}; |
my $peerfile="$perlvar{'lonSockDir'}/".$hostname{$server}; |
my $sclient=IO::Socket::UNIX->new(Peer =>"$peerfile", |
my $sclient; |
Type => SOCK_STREAM, |
for (my $retries = 0; $retries < $max_connection_retries; $retries++) { |
Timeout => 10) |
$sclient=IO::Socket::UNIX->new(Peer =>"$peerfile", |
or return "con_lost"; |
Type => SOCK_STREAM, |
|
Timeout => 10); |
|
if($sclient) { |
|
last; # Connected! |
|
} else { |
|
&create_connection($hostname{$server}); |
|
} |
|
sleep(1); # Try again later if failed connection. |
|
} |
print $sclient "sethost:$server:$cmd\n"; |
print $sclient "sethost:$server:$cmd\n"; |
my $answer=<$sclient>; |
my $answer=<$sclient>; |
chomp($answer); |
chomp($answer); |