Started the new routing stuff which will run in parallel for a while.
[spider.git] / perl / DXProt.pm
index ef3f331707180c754807f085411992367b1b267c..decd71f674452ea072172baab71a60b280d34f70 100644 (file)
@@ -31,6 +31,7 @@ use WCY;
 use Time::HiRes qw(gettimeofday tv_interval);
 use BadWords;
 use DXHash;
+use Route::Node;
 
 use strict;
 use vars qw($me $pc11_max_age $pc23_max_age
@@ -179,6 +180,8 @@ sub init
        do "$main::data/hop_table.pl" if -e "$main::data/hop_table.pl";
        confess $@ if $@;
        $me->{sort} = 'S';    # S for spider
+       $me->{priv} = 9;
+       $Route::Node::me->adddxchan($me);
 }
 
 #
@@ -370,8 +373,19 @@ sub normal
                                        return;
                                }
                        }
+
+                       my @spot = Spot::prepare($field[1], $field[2], $d, $field[5], $field[6], $field[7]);
+                       # global spot filtering on INPUT
+                       if ($self->{inspotsfilter}) {
+                               my ($filter, $hops) = $self->{inspotsfilter}->it(@spot);
+                               unless ($filter) {
+                                       dbg('chan', "PCPROT: Rejected by filter");
+                                       return;
+                               }
+                       }
                        
-                       my @spot = Spot::add($field[1], $field[2], $d, $field[5], $field[6], $field[7]);
+                       # add it 
+                       Spot::add(@spot);
 
             #
                        # @spot at this point contains:-
@@ -1119,6 +1133,7 @@ sub process
                next if $dxchan == $me;
                
                # send a pc50 out on this channel
+               $dxchan->{pc50_t} = $main::systime unless exists $dxchan->{pc50_t};
                if ($t >= $dxchan->{pc50_t} + $DXProt::pc50_interval) {
                        $dxchan->send(pc50(scalar DXChannel::get_all_users));
                        $dxchan->{pc50_t} = $t;