X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcluster.pl;h=dd12a9dfe22dc564058cadadb463bde7994f281a;hb=f3b23f65ec3e143910ec6a6c36cfe1ab37f0338c;hp=0ed98e55b39ddd33926ec6dbcd8e3aa670b080f2;hpb=6b19958cbe351af8d5462f4e0e03b87875eec16a;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index 0ed98e55..dd12a9df 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -60,6 +60,8 @@ use CmdAlias; use Filter; use Local; use DXDb; +use Data::Dumper; + use Fcntl ':flock'; use Carp qw(cluck); @@ -71,6 +73,7 @@ $systime = 0; # the time now (in seconds) $version = "1.35"; # the version no of the software $starttime = 0; # the starting time of the cluster $lockfn = "cluster.lock"; # lock file name +@outstanding_connects = (); # list of outstanding connects # handle disconnections sub disconnect @@ -101,7 +104,9 @@ sub rec my $dxchan = DXChannel->get_by_cnum($conn); # get the dxconnnect object for this message if (defined $err && $err) { - disconnect($dxchan) if defined $dxchan; + if ($dxchan) { + disconnect($dxchan); + } return; } @@ -227,6 +232,7 @@ sub reap { $SIG{'CHLD'} = \&reap; my $cpid = wait; + @outstanding_connects = grep {$_->{pid} != $cpid} @outstanding_connects; } # this is where the input queue is dealt with and things are dispatched off to other parts of @@ -262,6 +268,7 @@ sub process_inqueue $dxchan->normal($line); disconnect($dxchan) if ($dxchan->{state} eq 'bye'); } elsif ($sort eq 'Z') { + $dxchan->conn(undef); disconnect($dxchan); } elsif ($sort eq 'D') { ; # ignored (an echo)