]> dxcluster.org Git - spider.git/commitdiff
1. make spot dups look back 5 mins.
authorminima <minima>
Mon, 3 Sep 2001 09:26:42 +0000 (09:26 +0000)
committerminima <minima>
Mon, 3 Sep 2001 09:26:42 +0000 (09:26 +0000)
2. strip the top off each character in any text field of a Spot for duping.
3. Try to make the routing tables more accurate for users that login to
more than one node.
4. Make PC50s come out in one heap on all channels every 14 mins, instead of
on the 14th minute in the connection time for each channel. This should
reduce (slightly) the dups that are dumped.

Changes
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/DXDupe.pm
perl/DXProt.pm
perl/Route.pm
perl/Route/Node.pm
perl/Route/User.pm
perl/Spot.pm

diff --git a/Changes b/Changes
index b77d74c05a280ccf116805c0bf49b382635285b6..bf1412d6b25b3451caac1c63c0acd1564830cfb7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,11 @@
+03Sep01=======================================================================
+1. make spot dups look back 5 mins.
+2. strip the top off each character in any text field of a Spot for duping.
+3. Try to make the routing tables more accurate for users that login to
+more than one node.
+4. Make PC50s come out in one heap on all channels every 14 mins, instead of
+on the 14th minute in the connection time for each channel. This should 
+reduce (slightly) the dups that are dumped.
 01Sep01=======================================================================
 1. Change build number calc (hopefully for the last time)
 27Aug01=======================================================================
@@ -9,7 +17,8 @@ privilege is 1 or less and which isn't mentioned as an argument to the
 command on the command line.
 3. make set/node, set/spider and their friends unlock a node as well as make
 them one. 
-4. Make sh/log et al more efficient / less memory hungry
+4. Make sh/log et al more efficient / less memory hungry (and the display
+the correct way round!)
 24Aug01=======================================================================
 1. Allow badmsg to reject on interface callsign ('I')
 20Aug01=======================================================================
index 30a7897092e20a61f50fddf8807bf268075a6c7e..15bd6d2bffccbbcc994a22825d3545771831a0e0 100644 (file)
@@ -447,6 +447,7 @@ sub tell_login
        my $dxchan;
        foreach $dxchan (@dxchan) {
                next if $dxchan == $self;
+               next if $dxchan->{call} eq $main::mycall;
                $dxchan->send($dxchan->msg($m, $self->{call})) if $dxchan->{logininfo};
        }
 }
index f00163297e43d367abf0d8ef249d25a3e8278129..96ccc0a494aa872575064fee0a22cee274ad30c9 100644 (file)
@@ -425,8 +425,14 @@ sub disconnect
        my $call = $self->call;
        delete $self->{senddbg};
 
-       my @rout = $main::routeroot->del_user($call);
-       dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
+       my $uref = Route::User::get($call);
+       my @rout;
+       if ($uref) {
+               @rout = $main::routeroot->del_user($uref);
+               dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
+       } else {
+               confess "trying to disconnect a non existant user $call";
+       }
 
        # issue a pc17 to everybody interested
        DXProt::route_pc17($DXProt::me, $main::routeroot, @rout) if @rout;
index 5a01bee99a6acdfa1e6e39c204e623a2d1c46ba4..bcc0f7b0ea843a0aeaf080781a4a1355b7c8db2b 100644 (file)
@@ -40,10 +40,21 @@ sub finish
 sub check
 {
        my ($s, $t) = @_;
-       return 1 if exists $d{$s};
+       return 1 if find($s);
+       add($s, $t);
+       return 0;
+}
+
+sub find
+{
+       return 1 if exists $d{$_[0]};
+}
+
+sub add
+{
+       my ($s, $t) = @_;
        $t = $main::systime + $default unless $t;
        $d{$s} = $t;
-       return 0;
 }
 
 sub del
index 310a3e87b94b61ecc17c43cb32d13123ca570b6a..c5f4384cdfc74fcf8618eb481189404b98415964 100644 (file)
@@ -41,7 +41,7 @@ $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
 $main::build += $VERSION;
 $main::branch += $BRANCH;
 
-use vars qw($me $pc11_max_age $pc23_max_age
+use vars qw($me $pc11_max_age $pc23_max_age $last_pc50
                        $last_hour $last10 %eph  %pings %rcmds
                        %nodehops $baddx $badspotter $badnode $censorpc
                        $allowzero $decode_dk0wcy $send_opernam @checklist);
@@ -59,7 +59,7 @@ $censorpc = 1;                                        # Do a BadWords::check on text fields and reject things
 $baddx = new DXHash "baddx";
 $badspotter = new DXHash "badspotter";
 $badnode = new DXHash "badnode";
-$last10 = time;
+$last10 = $last_pc50 = time;
 
 @checklist = 
 (
@@ -578,7 +578,7 @@ sub normal
                                                $r->flags($flags);
                                                push @rout, $r;
                                        }
-                                       $r->addparent($ncall);
+                                       $r->addparent($parent);
                                } else {
                                        push @rout, $parent->add_user($call, $flags);
                                }
@@ -626,11 +626,17 @@ sub normal
                                dbg("PCPROT: Route::Node $ncall not in config") if isdbg('chanerr');
                                return;
                        }
+                       my $uref = Route::User::get($ucall);
+                       unless ($uref) {
+                               dbg("PCPROT: Route::User $ucall not in config") if isdbg('chanerr');
+                               return;
+                       }
+                       
 
                        # input filter if required
                        return unless $self->in_filter_route($parent);
-
-                       my @rout = $parent->del_user($ucall);
+                       
+                       my @rout = $parent->del_user($uref);
 
                        if (eph_dup($line)) {
                                dbg("PCPROT: dup PC17 detected") if isdbg('chanerr');
@@ -1122,20 +1128,22 @@ sub process
        my $t = time;
        my @dxchan = DXChannel->get_all();
        my $dxchan;
+       my $pc50s;
        
+       # send out a pc50 on EVERY channel all at once
+       if ($t >= $last_pc50 + $DXProt::pc50_interval) {
+               $pc50s = pc50($me, scalar DXChannel::get_all_users);
+               eph_dup($pc50s);
+               $last_pc50 = $t;
+       }
+
        foreach $dxchan (@dxchan) {
                next unless $dxchan->is_node();
                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) {
-                       my $s = pc50($me, scalar DXChannel::get_all_users);
-                       eph_dup($s);
-                       $dxchan->send($s);
-                       $dxchan->{pc50_t} = $t;
-               } 
 
+               # send the pc50
+               $dxchan->send($pc50s) if $pc50s;
+               
                # send a ping out on this channel
                if ($dxchan->{pingint} && $t >= $dxchan->{pingint} + $dxchan->{lastping}) {
                        if ($dxchan->{nopings} <= 0) {
@@ -1727,7 +1735,6 @@ sub disconnect
        my $node = Route::Node::get($call);
        my @rout;
        if ($node) {
-#              @rout = $node->del_nodes;    # at the next level
                @rout = $node->del($main::routeroot);
        }
        
index 6a4f96f60c6f9101e7dd6cae66f0b8d42b7ce1ee..7276c6979fc7f08510cb1d2df8328dae7a470996 100644 (file)
@@ -92,28 +92,41 @@ sub _addlist
 {
        my $self = shift;
        my $field = shift;
+       my @out;
        foreach my $c (@_) {
-               my $call = _getcall($c);
-               unless (grep {$_ eq $call} @{$self->{$field}}) {
+               confess "Need a ref here" unless ref($c);
+               
+               my $call = $c->{call};
+               unless (grep $_ eq $call, @{$self->{$field}}) {
                        push @{$self->{$field}}, $call;
                        dbg(ref($self) . " adding $call to " . $self->{call} . "->\{$field\}") if isdbg('routelow');
+                       push @out, $c;
                }
        }
-       return $self->{$field};
+       return @out;
 }
 
 sub _dellist
 {
        my $self = shift;
        my $field = shift;
+       my @out;
        foreach my $c (@_) {
-               my $call = _getcall($c);
-               if (grep {$_ eq $call} @{$self->{$field}}) {
+               confess "Need a ref here" unless ref($c);
+               my $call = $c->{call};
+               if (grep $_ eq $call, @{$self->{$field}}) {
                        $self->{$field} = [ grep {$_ ne $call} @{$self->{$field}} ];
                        dbg(ref($self) . " deleting $call from " . $self->{call} . "->\{$field\}") if isdbg('routelow');
+                       push @out, $c;
                }
        }
-       return $self->{$field};
+       return @out;
+}
+
+sub is_empty
+{
+       my $self = shift;
+       return @{$self->{$_[0]}} == 0;
 }
 
 #
index 6a2e2eaabe990ea600bd7ac6453252618d39723d..08b74c737295b15006a959e431a0eaa34b19fd42 100644 (file)
@@ -44,6 +44,7 @@ sub count
 
 sub max
 {
+       count();
        return $max;
 }
 
@@ -66,12 +67,12 @@ sub add
        confess "Route::add trying to add $call to myself" if $call eq $parent->{call};
        my $self = get($call);
        if ($self) {
-               $self->_addparent($parent->{call});
-               $parent->_addnode($call);
+               $self->_addparent($parent);
+               $parent->_addnode($self);
                return undef;
        }
-       $parent->_addnode($call);
        $self = $parent->new($call, @_);
+       $parent->_addnode($self);
        return $self;
 }
 
@@ -88,14 +89,13 @@ sub del
        my $pref = shift;
 
        # delete parent from this call's parent list
-       my $pcall = $pref->{call};
-       my $ncall = $self->{call};
-       $pref->_delnode($ncall);;
-       my $ref = $self->_delparent($pcall);
+       $pref->_delnode($self);
+       my @ref = $self->_delparent($pref);
        my @nodes;
+       my $ncall = $self->{call};
        
        # is this the last connection, I have no parents anymore?
-       unless (@$ref) {
+       unless (@ref) {
                foreach my $rcall (@{$self->{nodes}}) {
                        next if grep $rcall eq $_, @_;
                        my $r = Route::Node::get($rcall);
@@ -137,16 +137,17 @@ sub add_user
 
        confess "Trying to add NULL User call to routing tables" unless $ucall;
 
-       $self->_adduser($ucall);
-
-       $self->{usercount} = scalar @{$self->{users}};
        my $uref = Route::User::get($ucall);
        my @out;
        if ($uref) {
-               $uref->addparent($self->{call});
+               @out = $uref->addparent($self);
        } else {
-               @out = Route::User->new($ucall, $self->{call}, @_);
+               $uref = Route::User->new($ucall, $self->{call}, @_);
+               @out = $uref;
        }
+       $self->_adduser($uref);
+       $self->{usercount} = scalar @{$self->{users}};
+
        return @out;
 }
 
@@ -154,10 +155,16 @@ sub add_user
 sub del_user
 {
        my $self = shift;
-       my $ucall = shift;
-       my $ref = Route::User::get($ucall);
-       $self->_deluser($ucall);
-       my @out = $ref->del($self) if $ref;
+       my $ref = shift;
+       my @out;
+       
+       if ($ref) {
+               @out = $self->_deluser($ref);
+               $ref->del($self);
+       } else {
+               confess "tried to delete non-existant $ref->{call} from $self->{call}";
+       }
+       $self->{usercount} = scalar @{$self->{users}};
        return @out;
 }
 
index bc28dbef511053f809ce75171775d88a8e20feb9..e510a165e2736e1d78cac926f419a0678716e192 100644 (file)
@@ -39,6 +39,7 @@ sub count
 
 sub max
 {
+       count();
        return $max;
 }
 
@@ -62,9 +63,7 @@ sub del
 {
        my $self = shift;
        my $pref = shift;
-       my $ref = $self->delparent($pref->{call});
-       return () if @$ref;
-       my @out = delete $list{$self->{call}};
+       my @out = $self->delparent($pref);
        return @out;
 }
 
index 78d2eda566c7536a0127ecb3a4f4eb2ae14f8e31..69a67b9e885668e6ec135db586d3e4085b9ec52f 100644 (file)
@@ -314,9 +314,16 @@ sub dup
        $text = substr($text, 0, $duplth) if length $text > $duplth; 
        unpad($text);
        $text =~ s/[\\\%]\d+//g;
+       $text = pack("C*", map {$_ & 127} unpack("C*", $text));
        $text =~ s/[^a-zA-Z0-9]//g;
+       for (0,60,120,180,240,300) {
+               my $dt = $d - $_;
+               my $dupkey = "X$freq|$call|$dt|\L$text";
+               return 1 if DXDupe::find($dupkey);
+       }
        my $dupkey = "X$freq|$call|$d|\L$text";
-       return DXDupe::check($dupkey, $main::systime+$dupage);
+       DXDupe::add($dupkey, $main::systime+$dupage);
+       return 0;
 }
 
 sub listdups