add Thingy
[spider.git] / perl / cluster.pl
index 655a986b1af35dfd881795a3a3ffb320a867dc82..62227d218080c0c8199b4e1cfbee925a4b92d3e2 100755 (executable)
@@ -33,7 +33,7 @@ BEGIN {
 
        # try to create and lock a lockfile (this isn't atomic but 
        # should do for now
-       $lockfn = "$root/perl/cluster.lck";       # lock file name
+       $lockfn = "$root/local/cluster.lck";       # lock file name
        if (-e $lockfn) {
                open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
                my $pid = <CLLOCK>;
@@ -98,6 +98,8 @@ use Editable;
 use Mrtg;
 use USDB;
 use UDPMsg;
+use QSL;
+use Thingy;
 
 use Data::Dumper;
 use IO::File;
@@ -125,7 +127,7 @@ $reqreg = 0;                                        # 1 = registration required, 2 = deregister people
 use vars qw($VERSION $BRANCH $build $branch);
 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += 6;                             # add an offset to make it bigger than last system
+$main::build += 4;                             # add an offset to make it bigger than last system
 $main::build += $VERSION;
 $main::branch += $BRANCH;
 
@@ -240,6 +242,13 @@ sub rec
        }
 }
 
+# remove any outstanding entries on the inqueue after a disconnection (usually)
+sub clean_inqueue
+{
+       my $dxchan = shift;
+       @inqueue = grep {$_->{dxchan} != $dxchan} @inqueue;
+}
+
 sub login
 {
        return \&new_channel;
@@ -328,7 +337,7 @@ sub process_inqueue
                return unless defined $sort;
        
                # do the really sexy console interface bit! (Who is going to do the TK interface then?)
-               dbg("<- $sort $call $line\n") if $sort ne 'D' && isdbg('chan');
+               dbg("<- $sort $call $line") if $sort ne 'D' && isdbg('chan');
                if ($self->{disconnecting}) {
                        dbg('In disconnection, ignored');
                        next;
@@ -399,7 +408,7 @@ dbg("DXSpider Version $version, build $build started");
 
 # load Prefixes
 dbg("loading prefixes ...");
-my $r = Prefix::load();
+my $r = Prefix::init();
 confess $r if $r;
 dbg(USDB::init());
 
@@ -515,6 +524,7 @@ DXDb::load();
 
 # starting local stuff
 dbg("doing local initialisation ...");
+QSL::init(1);
 eval {
        Local::init();
 };
@@ -549,7 +559,10 @@ for (;;) {
                DXUser::process();
                DXDupe::process();
                AGWMsg::process();
-                               
+
+               # this where things really start to happen (in DXSpider 2)
+               Thingy::process();
+               
                eval { 
                        Local::process();       # do any localised processing
                };