added loginfo stuff
[spider.git] / perl / cluster.pl
index 0ed98e55b39ddd33926ec6dbcd8e3aa670b080f2..64cbab11ed1d6efc69ed2adc3f6896eb85ca8dee 100755 (executable)
@@ -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)
@@ -298,7 +305,7 @@ STDOUT->autoflush(1);
 Log('cluster', "DXSpider V$version started");
 
 # banner
-print "DXSpider DX Cluster Version $version\nCopyright (c) 1998 Dirk Koopman G1TLH\n";
+print "DXSpider DX Cluster Version $version\nCopyright (c) 1998-1999 Dirk Koopman G1TLH\n";
 
 # load Prefixes
 print "loading prefixes ...\n";