version 1.53, 2003/07/31 21:32:44
|
version 1.56, 2003/10/24 16:36:14
|
Line 124 close(CONFIG);
|
Line 124 close(CONFIG);
|
%childatt = (); # number of attempts to start server |
%childatt = (); # number of attempts to start server |
# for ID |
# for ID |
|
|
$childmaxattempts=5; |
$childmaxattempts=15; |
|
|
# ---------------------------------------------------- Fork once and dissociate |
# ---------------------------------------------------- Fork once and dissociate |
&status("Fork and dissociate"); |
&status("Fork and dissociate"); |
Line 361 while (1) {
|
Line 361 while (1) {
|
# accept a new connection |
# accept a new connection |
&status("Accept new connection: $conserver"); |
&status("Accept new connection: $conserver"); |
$client = $server->accept(); |
$client = $server->accept(); |
if($DEBUG) { |
if (!$client) { |
&logthis("New client fd = ".$client->fileno."\n"); |
&logthis("Got stupid nonexisent client on ".$server->fileno." $conserver \n"); |
|
} else { |
|
if($DEBUG) { |
|
&logthis("New client fd = ".$client->fileno."\n"); |
|
} |
|
$servers{$client->fileno} = $client; |
|
nonblock($client); |
|
$client->sockopt(SO_KEEPALIVE, 1); # Enable monitoring of |
|
# connection liveness. |
} |
} |
$servers{$client->fileno} = $client; |
|
nonblock($client); |
|
$client->sockopt(SO_KEEPALIVE, 1);# Enable monitoring of |
|
# connection liveness. |
|
} |
} |
HandleInput($infdset, \%servers, \%inbuffer, \%outbuffer, \%ready); |
HandleInput($infdset, \%servers, \%inbuffer, \%outbuffer, \%ready); |
HandleOutput($outfdset, \%servers, \%outbuffer, \%inbuffer, |
HandleOutput($outfdset, \%servers, \%outbuffer, \%inbuffer, |
Line 638 sub handle {
|
Line 642 sub handle {
|
$request="enc:$cmdlength:$encrequest"; |
$request="enc:$cmdlength:$encrequest"; |
} |
} |
# --------------------------------------------------------------- Main exchange |
# --------------------------------------------------------------- Main exchange |
$answer = londtransaction($remotesock, $request, 300); |
$answer = londtransaction($remotesock, $request, 60); |
|
|
if($DEBUG) { |
if($DEBUG) { |
&logthis("<font color=green> Request data exchange complete"); |
&logthis("<font color=green> Request data exchange complete"); |
Line 707 sub openremote {
|
Line 711 sub openremote {
|
my $st=120+int(rand(240)); # Sleep before opening: |
my $st=120+int(rand(240)); # Sleep before opening: |
|
|
unless ( |
unless ( |
$remotesock = IO::Socket::INET->new(PeerAddr => $hostip{$conserver}, |
$remotesock = IO::Socket::INET->new(PeerAddr => $hostname{$conserver}, |
PeerPort => $perlvar{'londPort'}, |
PeerPort => $perlvar{'londPort'}, |
Proto => "tcp", |
Proto => "tcp", |
Type => SOCK_STREAM) |
Type => SOCK_STREAM) |
Line 988 sub londtransaction {
|
Line 992 sub londtransaction {
|
alarm(0); |
alarm(0); |
}; |
}; |
} else { |
} else { |
&logthis("lonc - suiciding on send Timeout"); |
&logthis("lonc - $conserver - suiciding on send Timeout"); |
die("lonc - suiciding on send Timeout"); |
die("lonc - $conserver - suiciding on send Timeout"); |
} |
} |
if ($@ =~ /timeout/) { |
if ($@ =~ /timeout/) { |
&logthis("lonc - suiciding on read Timeout"); |
&logthis("lonc - $conserver - suiciding on read Timeout"); |
die("lonc - suiciding on read Timeout"); |
die("lonc - $conserver - suiciding on read Timeout"); |
} |
} |
# |
# |
# Restore the initial sigmask set. |
# Restore the initial sigmask set. |